[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZilEXC3qLiqMTs29@casper.infradead.org>
Date: Wed, 24 Apr 2024 18:41:48 +0100
From: Matthew Wilcox <willy@...radead.org>
To: Jeongjun Park <aha310510@...il.com>
Cc: shaggy@...nel.org,
syzbot+241c815bda521982cb49@...kaller.appspotmail.com,
brauner@...nel.org, jlayton@...nel.org, eadavis@...com,
jfs-discussion@...ts.sourceforge.net, linux-fsdevel@...r.kernel.org,
linux-kernel@...r.kernel.org, syzkaller-bugs@...glegroups.com
Subject: Re: [PATCH] jfs: Fix array-index-out-of-bounds in diFree
On Thu, Apr 25, 2024 at 02:22:40AM +0900, Jeongjun Park wrote:
> Due to overflow, a value that is too large is entered into the agno
> value. Therefore, we need to add code to check the agno value.
This is clearly wrong.
#define BLKTOAG(b,sbi) ((b) >> ((sbi)->bmap->db_agl2size))
I'd suggest that something has either corrupted the sbi->bmap
pointer or the sbi->bmap->db_agl2size value.
All your patch does is cover up the problem, not fix it.
> Reported-by: syzbot+241c815bda521982cb49@...kaller.appspotmail.com
> Signed-off-by: Jeongjun Park <aha310510@...il.com>
> ---
> fs/jfs/jfs_imap.c | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/fs/jfs/jfs_imap.c b/fs/jfs/jfs_imap.c
> index 2ec35889ad24..0aac083bc0db 100644
> --- a/fs/jfs/jfs_imap.c
> +++ b/fs/jfs/jfs_imap.c
> @@ -881,6 +881,11 @@ int diFree(struct inode *ip)
> */
> agno = BLKTOAG(JFS_IP(ip)->agstart, JFS_SBI(ip->i_sb));
>
> + if(agno >= MAXAG || agno < 0){
> + jfs_error(ip->i_sb, "invalid array index (0 <= agno < MAXAG), agno = %d\n", agno);
> + return -ENOMEM;
> + }
> +
> /* Lock the AG specific inode map information
> */
> AG_LOCK(imap, agno);
> --
> 2.34.1
>
Powered by blists - more mailing lists