From: Yunfeng Ye <yeyunfeng@huawei.com>
To: <akpm@linux-foundation.org>, <zhengbin13@huawei.com>,
<jack@suse.cz>, <yanaijie@huawei.com>, <darrick.wong@oracle.com>,
<linux.bhar@gmail.com>, <hariprasad.kelam@gmail.com>,
<deepa.kernel@gmail.com>, <reiserfs-devel@vger.kernel.org>,
<linux-kernel@vger.kernel.org>
Cc: "hushiyuan@huawei.com" <hushiyuan@huawei.com>,
"linfeilong@huawei.com" <linfeilong@huawei.com>
Subject: [PATCH] reiserfs: prevent NULL pointer dereference in reiserfs_insert_item()
Date: Mon, 16 Dec 2019 20:05:32 +0800 [thread overview]
Message-ID: <20c04f55-aa48-d28a-f8ff-1efed8a38f3a@huawei.com> (raw)
In-Reply-To: <79c5135d-ff25-1cc9-4e99-9f572b88cc00@huawei.com>
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
next prev parent reply other threads:[~2019-12-16 12:06 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-12-04 14:22 Yunfeng Ye
2019-12-16 12:05 ` Yunfeng Ye [this message]
2019-12-16 17:05 ` Jan Kara
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20c04f55-aa48-d28a-f8ff-1efed8a38f3a@huawei.com \
--to=yeyunfeng@huawei.com \
--cc=akpm@linux-foundation.org \
--cc=darrick.wong@oracle.com \
--cc=deepa.kernel@gmail.com \
--cc=hariprasad.kelam@gmail.com \
--cc=hushiyuan@huawei.com \
--cc=jack@suse.cz \
--cc=linfeilong@huawei.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux.bhar@gmail.com \
--cc=reiserfs-devel@vger.kernel.org \
--cc=yanaijie@huawei.com \
--cc=zhengbin13@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®