lkml.org 
[lkml]   [2023]   [Oct]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] jfs : fix array-index-out-of-bounds in diWrite
Date
Currently while copying dtree root from inode to dnode in the xp slot
there is a out of bound memcpy. Added a bound check to the memcpy.

Reported-by: syzbot+c1056fdfe414463fdb33@syzkaller.appspotmail.com
Fixes: https://syzkaller.appspot.com/bug?extid=c1056fdfe414463fdb33
Signed-off-by: Manas Ghandat <ghandatmanas@gmail.com>
---
fs/jfs/jfs_imap.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/fs/jfs/jfs_imap.c b/fs/jfs/jfs_imap.c
index 799d3837e7c2..d1f897848be0 100644
--- a/fs/jfs/jfs_imap.c
+++ b/fs/jfs/jfs_imap.c
@@ -746,7 +746,8 @@ int diWrite(tid_t tid, struct inode *ip)
xp = (dtpage_t *) & dp->di_dtroot;
lv = ilinelock->lv;
for (n = 0; n < ilinelock->index; n++, lv++) {
- memcpy(&xp->slot[lv->offset], &p->slot[lv->offset],
+ if (lv->offset < 128)
+ memcpy(&xp->slot[lv->offset], &p->slot[lv->offset],
lv->length << L2DTSLOTSIZE);
}
} else {
--
2.37.2
\
 
 \ /
  Last update: 2023-10-08 19:49    [W:0.248 / U:0.020 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site