* [PATCH] reiserfs: prevent NULL pointer dereference in reiserfs_insert_item()
@ 2019-12-04 14:22 Yunfeng Ye
2019-12-16 12:05 ` Yunfeng Ye
0 siblings, 1 reply; 3+ messages in thread
From: Yunfeng Ye @ 2019-12-04 14:22 UTC (permalink / raw)
To: akpm, zhengbin13, reiserfs-devel, linux-kernel, hushiyuan, linfeilong
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 <yeyunfeng@huawei.com>
---
fs/reiserfs/stree.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/fs/reiserfs/stree.c b/fs/reiserfs/stree.c
index da9ebe33882b..bb4973aefbb1 100644
--- a/fs/reiserfs/stree.c
+++ b/fs/reiserfs/stree.c
@@ -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
--
2.7.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH] reiserfs: prevent NULL pointer dereference in reiserfs_insert_item()
2019-12-04 14:22 [PATCH] reiserfs: prevent NULL pointer dereference in reiserfs_insert_item() Yunfeng Ye
@ 2019-12-16 12:05 ` Yunfeng Ye
2019-12-16 17:05 ` Jan Kara
0 siblings, 1 reply; 3+ messages in thread
From: Yunfeng Ye @ 2019-12-16 12:05 UTC (permalink / raw)
To: akpm, zhengbin13, jack, yanaijie, darrick.wong, linux.bhar,
hariprasad.kelam, deepa.kernel, reiserfs-devel, linux-kernel
Cc: hushiyuan, linfeilong
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 <yeyunfeng@huawei.com>
---
fs/reiserfs/stree.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/fs/reiserfs/stree.c b/fs/reiserfs/stree.c
index da9ebe33882b..bb4973aefbb1 100644
--- a/fs/reiserfs/stree.c
+++ b/fs/reiserfs/stree.c
@@ -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
--
2.7.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] reiserfs: prevent NULL pointer dereference in reiserfs_insert_item()
2019-12-16 12:05 ` Yunfeng Ye
@ 2019-12-16 17:05 ` Jan Kara
0 siblings, 0 replies; 3+ messages in thread
From: Jan Kara @ 2019-12-16 17:05 UTC (permalink / raw)
To: Yunfeng Ye
Cc: akpm, zhengbin13, jack, yanaijie, darrick.wong, linux.bhar,
hariprasad.kelam, deepa.kernel, reiserfs-devel, linux-kernel,
hushiyuan, linfeilong
On Mon 16-12-19 20:05:32, Yunfeng Ye wrote:
> 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 <yeyunfeng@huawei.com>
Thanks, I've added the patch to my tree.
Honza
> ---
> fs/reiserfs/stree.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/fs/reiserfs/stree.c b/fs/reiserfs/stree.c
> index da9ebe33882b..bb4973aefbb1 100644
> --- a/fs/reiserfs/stree.c
> +++ b/fs/reiserfs/stree.c
> @@ -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
> --
> 2.7.4
>
--
Jan Kara <jack@suse.com>
SUSE Labs, CR
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-12-16 17:06 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-04 14:22 [PATCH] reiserfs: prevent NULL pointer dereference in reiserfs_insert_item() Yunfeng Ye
2019-12-16 12:05 ` Yunfeng Ye
2019-12-16 17:05 ` Jan Kara
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).