mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Zhihao Cheng <chengzhihao1@huawei.com>
To: Konstantin Meskhidze <konstantin.meskhidze@huawei.com>, <richard@nod.at>
Cc: <linux-mtd@lists.infradead.org>, <linux-kernel@vger.kernel.org>,
	<yusongping@huawei.com>, <artem.kuzin@huawei.com>
Subject: Re: [PATCH] ubifs: fix possible dereference after free
Date: Wed, 6 Sep 2023 09:42:27 +0800	[thread overview]
Message-ID: <939c0385-8663-91a2-df20-920f264a2aa1@huawei.com> (raw)
In-Reply-To: <20230905101222.1725230-1-konstantin.meskhidze@huawei.com>

在 2023/9/5 18:12, Konstantin Meskhidze 写道:
> 'old_idx' could be dereferenced after free via 'rb_link_node' function
> call.
> 
> Fixes: b5fda08ef213 ("ubifs: Fix memleak when insert_old_idx() failed")
> Co-developed-by: Ivanov Mikhail <ivanov.mikhail1@huawei-partners.com>
> Signed-off-by: Konstantin Meskhidze <konstantin.meskhidze@huawei.com>
> ---
>   fs/ubifs/tnc.c | 1 +
>   1 file changed, 1 insertion(+)
> 

Only for static alarms,although it couldn't happen in theory.

Reviewed-by: Zhihao Cheng <chengzhihao1@huawei.com>

> diff --git a/fs/ubifs/tnc.c b/fs/ubifs/tnc.c
> index 6b7d95b65f4b..f4728e65d1bd 100644
> --- a/fs/ubifs/tnc.c
> +++ b/fs/ubifs/tnc.c
> @@ -64,8 +64,9 @@ static void do_insert_old_idx(struct ubifs_info *c,
>   			p = &(*p)->rb_right;
>   		else {
>   			ubifs_err(c, "old idx added twice!");
>   			kfree(old_idx);
> +			return;
>   		}
>   	}
>   	rb_link_node(&old_idx->rb, parent, p);
>   	rb_insert_color(&old_idx->rb, &c->old_idx);
> 


      reply	other threads:[~2023-09-06  1:42 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-05 10:12 Konstantin Meskhidze
2023-09-06  1:42 ` Zhihao Cheng [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=939c0385-8663-91a2-df20-920f264a2aa1@huawei.com \
    --to=chengzhihao1@huawei.com \
    --cc=artem.kuzin@huawei.com \
    --cc=konstantin.meskhidze@huawei.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=richard@nod.at \
    --cc=yusongping@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®