From: Yunfeng Ye Date: Fri, 31 Jan 2020 06:17:26 +0000 (-0800) Subject: reiserfs: prevent NULL pointer dereference in reiserfs_insert_item() X-Git-Tag: v5.15~4586^2~3 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=aacee5446a2a1aa35d0a49dab289552578657fb4;p=platform%2Fkernel%2Flinux-starfive.git reiserfs: prevent NULL pointer dereference in reiserfs_insert_item() The variable inode may be NULL in reiserfs_insert_item(), but there is no check before accessing the member of inode. Fix this by adding NULL pointer check before calling reiserfs_debug(). Link: http://lkml.kernel.org/r/79c5135d-ff25-1cc9-4e99-9f572b88cc00@huawei.com Signed-off-by: Yunfeng Ye Cc: zhengbin Cc: Hu Shiyuan Cc: Feilong Lin Cc: Jan Kara Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/fs/reiserfs/stree.c b/fs/reiserfs/stree.c index da9ebe3..bb4973a 100644 --- a/fs/reiserfs/stree.c +++ b/fs/reiserfs/stree.c @@ -2246,7 +2246,8 @@ error_out: /* also releases the path */ unfix_nodes(&s_ins_balance); #ifdef REISERQUOTA_DEBUG - reiserfs_debug(th->t_super, REISERFS_DEBUG_CODE, + if (inode) + reiserfs_debug(th->t_super, REISERFS_DEBUG_CODE, "reiserquota insert_item(): freeing %u id=%u type=%c", quota_bytes, inode->i_uid, head2type(ih)); #endif