summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYunfeng Ye <yeyunfeng@huawei.com>2020-01-30 22:17:26 -0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2020-02-24 08:34:52 +0100
commit42cdf18d72e4cf43516119b478400d00836d9765 (patch)
tree801a7237d955c7eb5537616491b9858168858fa1
parentacaf62810c91f2a733f784e62b126466ec7950a7 (diff)
downloadlinux-stable-42cdf18d72e4cf43516119b478400d00836d9765.tar.gz
linux-stable-42cdf18d72e4cf43516119b478400d00836d9765.tar.bz2
linux-stable-42cdf18d72e4cf43516119b478400d00836d9765.zip
reiserfs: prevent NULL pointer dereference in reiserfs_insert_item()
[ Upstream commit aacee5446a2a1aa35d0a49dab289552578657fb4 ] 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 <yeyunfeng@huawei.com> Cc: zhengbin <zhengbin13@huawei.com> Cc: Hu Shiyuan <hushiyuan@huawei.com> Cc: Feilong Lin <linfeilong@huawei.com> Cc: Jan Kara <jack@suse.cz> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
-rw-r--r--fs/reiserfs/stree.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/fs/reiserfs/stree.c b/fs/reiserfs/stree.c
index 0037aea97d39..2946713cb00d 100644
--- a/fs/reiserfs/stree.c
+++ b/fs/reiserfs/stree.c
@@ -2250,7 +2250,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