git: 21a943407e99 - stable/13 - udf: reject invalid block sizes from lvd
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 10 Aug 2023 02:58:37 UTC
The branch stable/13 has been updated by kib:
URL: https://cgit.FreeBSD.org/src/commit/?id=21a943407e9992a219a5fe572ee27fea9f5d2c69
commit 21a943407e9992a219a5fe572ee27fea9f5d2c69
Author: Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2023-08-04 22:47:09 +0000
Commit: Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2023-08-10 02:57:29 +0000
udf: reject invalid block sizes from lvd
PR: 272893
(cherry picked from commit 9e6941a2c7a393aefe6a123952c6eacbc23098a6)
---
sys/fs/udf/udf_vfsops.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/sys/fs/udf/udf_vfsops.c b/sys/fs/udf/udf_vfsops.c
index 3f6f481dfd6b..65b2ff5b2699 100644
--- a/sys/fs/udf/udf_vfsops.c
+++ b/sys/fs/udf/udf_vfsops.c
@@ -413,6 +413,11 @@ udf_mountfs(struct vnode *devvp, struct mount *mp)
lvd = (struct logvol_desc *)bp->b_data;
if (!udf_checktag(&lvd->tag, TAGID_LOGVOL)) {
udfmp->bsize = le32toh(lvd->lb_size);
+ if (udfmp->bsize < 0 || udfmp->bsize > maxbcachebuf) {
+ printf("lvd block size %d\n", udfmp->bsize);
+ error = EINVAL;
+ goto bail;
+ }
udfmp->bmask = udfmp->bsize - 1;
udfmp->bshift = ffs(udfmp->bsize) - 1;
fsd_part = le16toh(lvd->_lvd_use.fsd_loc.loc.part_num);