reiserfs: prevent NULL pointer dereference in reiserfs_insert_item()
PATCH 1/1 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().
--- fs/reiserfs/stree.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
fs/reiserfs/stree.c +2 -1
@@ -2246,7 +2246,8 @@ int reiserfs_insert_item(struct reiserfs_transaction_handle *th,/* 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
Signature · 1 line
2.7.4
PATCH 1/1 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().
--- fs/reiserfs/stree.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
fs/reiserfs/stree.c +2 -1
@@ -2246,7 +2246,8 @@ int reiserfs_insert_item(struct reiserfs_transaction_handle *th,/* 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
Signature · 1 line
2.7.4
Quoted 6 lines · Yunfeng Ye
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().Signed-off-by Yunfeng Ye <[email protected]>
Thanks, I've added the patch to my tree.
Honza
Quoted 21 lines
--- fs/reiserfs/stree.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)fs/reiserfs/stree.c +2
-1@@ -2246,7 +2246,8 @@ int reiserfs_insert_item(struct reiserfs_transaction_handle *th,/* 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 Signature · 1 line
2.7.4
Signature · 2 lines
Jan Kara <[email protected]> SUSE Labs, CR