public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
From: Richard Weinberger <richard@nod.at>
To: chengzhihao1 <chengzhihao1@huawei.com>
Cc: ZhaoLong Wang <wangzhaolong1@huawei.com>,
	 linux-mtd <linux-mtd@lists.infradead.org>,
	guoxuenan@huawei.com
Subject: Re: Two bug fix commit fixes in the ubi_resize_volume() were fixed by a patch in the mailing list
Date: Wed, 5 Apr 2023 22:48:09 +0200 (CEST)	[thread overview]
Message-ID: <2092125501.19940.1680727689243.JavaMail.zimbra@nod.at> (raw)
In-Reply-To: <f55c0db7-ef93-86ae-c4f9-476515358787@huawei.com>

----- Ursprüngliche Mail -----
> Von: "chengzhihao1" <chengzhihao1@huawei.com>
>>      I'd like to know why patch[1] didn't get into the mainline.
>>
>> [1] http://patchwork.ozlabs.org/project/linux-mtd/patch/20220124024056.1996763-1-guoxuenan@huawei.com/

Sorry, it fell through the cracks.

> I find there were three problems in ubi_resize_volume():
> 
> 1. Memleak  - fixed by 1e591ea072df ("ubi: Fix unreferenced object
> reported by kmemleak in ubi_resize_volume()")

Agreed.

> 2. UAF in error handling path  - fixed by 9af31d6ec1a4 ("ubi: Fix
> use-after-free when volume resizing failed")

Agreed.

> 3. UAF in concurrent shring volume and writing
> fastmap(vol->reserved_pebs iteration)  - fixed by [1]
> 4. Potentional data lost in failed shrinking(failed after unmapping
> lebs)  - mentioned in [1], which is not a big problem, we can add some
> comments to explain it.
> 5. Too many lebs used if expanding volume failed after [1] applied:
> If we update vol->reserved_pebs together with vol->eba_tbl, then other
> writing process could take lnum bigger than old vol->reserved_pebs.
> There will be zombie logical pebs(lnum greater than vol->reserved_pebs,
> could not be accessed or reclaimed) if resizing failed.
> Maybe we should fix that by holding 'leb_write_lock' while expanding volume?
> 6. In error handling path 'out_acc', UBI should recover 'ubi->rsvd_pebs'
> and 'ubi->avail_pebs' in 'pebs > 0' case, otherwise UBI will display
> wrong available peb count.
> 
> Richard, How do you think?

I agree, we should apply this patch. Guo Xuenan, can you please rebase your patch
on the latest kernel and resend?
vmt.c saw some changes and the patch does not longer apply.

Thanks,
//richard

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

  parent reply	other threads:[~2023-04-05 20:49 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-03  2:04 Two bug fix commit fixes in the ubi_resize_volume() were fixed by a patch in the mailing list ZhaoLong Wang
2023-04-03  3:55 ` Zhihao Cheng
2023-04-03  4:42   ` Zhihao Cheng
2023-04-05 20:48   ` Richard Weinberger [this message]
2023-04-06  1:20     ` Guo Xuenan
2023-04-06  3:07       ` ZhaoLong Wang

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=2092125501.19940.1680727689243.JavaMail.zimbra@nod.at \
    --to=richard@nod.at \
    --cc=chengzhihao1@huawei.com \
    --cc=guoxuenan@huawei.com \
    --cc=linux-mtd@lists.infradead.org \
    --cc=wangzhaolong1@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