mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] udf: fix uninit-value use in udf_get_fileshortad
@ 2024-09-19 19:52 Gianfranco Trad
  0 siblings, 0 replies; 3+ messages in thread
From: Gianfranco Trad @ 2024-09-19 19:52 UTC (permalink / raw)
  To: jack; +Cc: linux-kernel, skhan, Gianfranco Trad, syzbot+8901c4560b7ab5c2f9df

Syzbot reported a udf uninit-value use in udf_get_fileshortad[1].
The uninit-value use occurs when udf_get_fileshortad is called
with alen having a negative value and epos->offset being equal
to epos->bh->b_size. This check was inserted to mitigate
the uninit-value use. After applying the patch reproducer did
not trigget any issue[2].

[1] https://syzkaller.appspot.com/bug?extid=8901c4560b7ab5c2f9df
[2] https://syzkaller.appspot.com/x/log.txt?x=133ab69f980000

Reported-by: syzbot+8901c4560b7ab5c2f9df@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=8901c4560b7ab5c2f9df
Tested-by: syzbot+8901c4560b7ab5c2f9df@syzkaller.appspotmail.com
Signed-off-by: Gianfranco Trad <gianf.trad@gmail.com>
---
 fs/udf/inode.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/fs/udf/inode.c b/fs/udf/inode.c
index 4726a4d014b6..d21665164779 100644
--- a/fs/udf/inode.c
+++ b/fs/udf/inode.c
@@ -2222,6 +2222,8 @@ int8_t udf_current_aext(struct inode *inode, struct extent_position *epos,
 
 	switch (iinfo->i_alloc_type) {
 	case ICBTAG_FLAG_AD_SHORT:
+		if (unlikely(alen < 0 && epos->offset == epos->bh->b_size))
+			return -1;
 		sad = udf_get_fileshortad(ptr, alen, &epos->offset, inc);
 		if (!sad)
 			return -1;
-- 
2.43.0


^ permalink raw reply	[flat|nested] 3+ messages in thread
[parent not found: <202409230809.5ozgjLm9-lkp@intel.com>]

end of thread, other threads:[~2024-09-23 14:22 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-09-19 19:52 [PATCH] udf: fix uninit-value use in udf_get_fileshortad Gianfranco Trad
     [not found] <202409230809.5ozgjLm9-lkp@intel.com>
2024-09-23  9:23 ` Gianfranco Trad
2024-09-23 14:22   ` Jan Kara

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®