fs/ntfs3/super.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
syzbot reported UBSAN error as below:
[ 76.901829][ T6677] ================================================================================
[ 76.903908][ T6677] UBSAN: shift-out-of-bounds in fs/ntfs3/super.c:675:13
[ 76.905363][ T6677] shift exponent -247 is negative
This patch avoid this error.
Link: https://syzkaller.appspot.com/bug?id=b0299c09a14aababf0f1c862dd4ebc8ab9eb0179
Fixes: a3b774342fa7 (fs/ntfs3: validate BOOT sectors_per_clusters)
Cc: Author: Randy Dunlap <rdunlap@infradead.org>
Reported-by: syzbot+35b87c668935bb55e666@syzkaller.appspotmail.com
Signed-off-by: Shigeru Yoshida <syoshida@redhat.com>
---
fs/ntfs3/super.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/ntfs3/super.c b/fs/ntfs3/super.c
index 47012c9bf505..adc4f73722b7 100644
--- a/fs/ntfs3/super.c
+++ b/fs/ntfs3/super.c
@@ -672,7 +672,7 @@ static u32 true_sectors_per_clst(const struct NTFS_BOOT *boot)
if (boot->sectors_per_clusters <= 0x80)
return boot->sectors_per_clusters;
if (boot->sectors_per_clusters >= 0xf4) /* limit shift to 2MB max */
- return 1U << (0 - boot->sectors_per_clusters);
+ return 1U << -(s8)boot->sectors_per_clusters;
return -EINVAL;
}
--
2.37.2
On 8/23/22 17:46, Shigeru Yoshida wrote: > syzbot reported UBSAN error as below: > > [ 76.901829][ T6677] ================================================================================ > [ 76.903908][ T6677] UBSAN: shift-out-of-bounds in fs/ntfs3/super.c:675:13 > [ 76.905363][ T6677] shift exponent -247 is negative > > This patch avoid this error. > > Link: https://syzkaller.appspot.com/bug?id=b0299c09a14aababf0f1c862dd4ebc8ab9eb0179 > Fixes: a3b774342fa7 (fs/ntfs3: validate BOOT sectors_per_clusters) > Cc: Author: Randy Dunlap <rdunlap@infradead.org> > Reported-by: syzbot+35b87c668935bb55e666@syzkaller.appspotmail.com > Signed-off-by: Shigeru Yoshida <syoshida@redhat.com> > --- > fs/ntfs3/super.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/fs/ntfs3/super.c b/fs/ntfs3/super.c > index 47012c9bf505..adc4f73722b7 100644 > --- a/fs/ntfs3/super.c > +++ b/fs/ntfs3/super.c > @@ -672,7 +672,7 @@ static u32 true_sectors_per_clst(const struct NTFS_BOOT *boot) > if (boot->sectors_per_clusters <= 0x80) > return boot->sectors_per_clusters; > if (boot->sectors_per_clusters >= 0xf4) /* limit shift to 2MB max */ > - return 1U << (0 - boot->sectors_per_clusters); > + return 1U << -(s8)boot->sectors_per_clusters; > return -EINVAL; > } > Applied, thanks again for the patch!
ping? On Tue, 23 Aug 2022 23:46:25 +0900, Shigeru Yoshida wrote: > syzbot reported UBSAN error as below: > > [ 76.901829][ T6677] ================================================================================ > [ 76.903908][ T6677] UBSAN: shift-out-of-bounds in fs/ntfs3/super.c:675:13 > [ 76.905363][ T6677] shift exponent -247 is negative > > This patch avoid this error. > > Link: https://syzkaller.appspot.com/bug?id=b0299c09a14aababf0f1c862dd4ebc8ab9eb0179 > Fixes: a3b774342fa7 (fs/ntfs3: validate BOOT sectors_per_clusters) > Cc: Author: Randy Dunlap <rdunlap@infradead.org> > Reported-by: syzbot+35b87c668935bb55e666@syzkaller.appspotmail.com > Signed-off-by: Shigeru Yoshida <syoshida@redhat.com> > --- > fs/ntfs3/super.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/fs/ntfs3/super.c b/fs/ntfs3/super.c > index 47012c9bf505..adc4f73722b7 100644 > --- a/fs/ntfs3/super.c > +++ b/fs/ntfs3/super.c > @@ -672,7 +672,7 @@ static u32 true_sectors_per_clst(const struct NTFS_BOOT *boot) > if (boot->sectors_per_clusters <= 0x80) > return boot->sectors_per_clusters; > if (boot->sectors_per_clusters >= 0xf4) /* limit shift to 2MB max */ > - return 1U << (0 - boot->sectors_per_clusters); > + return 1U << -(s8)boot->sectors_per_clusters; > return -EINVAL; > } > > -- > 2.37.2 >
© 2016 - 2026 Red Hat, Inc.