mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jan Kara <jack@suse.cz>
To: Yunfeng Ye <yeyunfeng@huawei.com>
Cc: 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,
	"hushiyuan@huawei.com" <hushiyuan@huawei.com>,
	"linfeilong@huawei.com" <linfeilong@huawei.com>
Subject: Re: [PATCH] reiserfs: prevent NULL pointer dereference in reiserfs_insert_item()
Date: Mon, 16 Dec 2019 18:05:53 +0100	[thread overview]
Message-ID: <20191216170553.GA16051@quack2.suse.cz> (raw)
In-Reply-To: <20c04f55-aa48-d28a-f8ff-1efed8a38f3a@huawei.com>

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

      reply	other threads:[~2019-12-16 17: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
2019-12-16 17:05   ` Jan Kara [this message]

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=20191216170553.GA16051@quack2.suse.cz \
    --to=jack@suse.cz \
    --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=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=yeyunfeng@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®