All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tao Cui <cui.tao@linux.dev>
To: Christian Brauner <brauner@kernel.org>, Jan Kara <jack@suse.cz>,
	brads@mainlining.org
Cc: cui.tao@linux.dev, kees@kernel.org, cyphar@cyphar.com,
	containers@vger.kernel.org, linux-kernel@vger.kernel.org,
	cuitao@kylinos.cn
Subject: Re: [PATCH 2/2] userns: don't clear the install target map on map_write() failure
Date: Mon, 31 Aug 2026 21:08:03 +0800	[thread overview]
Message-ID: <5d152da3-bdda-4a3c-8067-f3a8b7d9f786@linux.dev> (raw)
In-Reply-To: <20260831-ammoniak-blaskapelle-abbitten-db32791d39b7@brauner>



在 2026/8/31 18:08, Christian Brauner 写道:
> On Fri, Aug 28, 2026 at 11:51:10AM +0200, Jan Kara wrote:
>> On Fri 28-08-26 17:16:59, Tao Cui wrote:
>>> From: Tao Cui <cuitao@kylinos.cn>
>>>
>>> At the out: label of map_write() the destination map is also cleared
>>> (map->forward = NULL; map->reverse = NULL; map->nr_extents = 0)
>>> whenever the write failed and the extent arrays had to be freed.
>>>
>>> However, the destination map is written by the successful install
>>> block above, which has no failure exit; every error path reaches
>>> out: without having touched it.  A second write to a mapped
>>> namespace is also rejected with -EPERM before any parsing happens,
>>> so the clearing can never roll back a previously installed map
>>> either.
>>>
>>> The three assignments just zero an already-zero map.  Remove them.
>>>
>>> Signed-off-by: Tao Cui <cuitao@kylinos.cn>
>>
>> I agree this is a dead code but it kind of makes it easier to argue about
>> the correctness of the error handling branch. I guess I'll leave it to for
>> Christian to decide whether he wants to take this or not.
> 
> Nah, let's leave this as is. :)

Understood, that's a fair point.  I'm fine dropping this one.

Thanks for the review, Jan.  Thanks for picking up 1/2, Christian.
And thanks for the Reviewed-by tag, Bradley.

--
Tao


  reply	other threads:[~2026-08-31 13:08 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-28  9:16 [PATCH 0/2] userns: clean up dead code on error paths Tao Cui
2026-08-28  9:16 ` [PATCH 1/2] userns: remove dead key_put() on the create_user_ns() error path Tao Cui
2026-08-28  9:41   ` Jan Kara
2026-08-28 11:45   ` Bradley Morgan
2026-08-28  9:16 ` [PATCH 2/2] userns: don't clear the install target map on map_write() failure Tao Cui
2026-08-28  9:51   ` Jan Kara
2026-08-31 10:08     ` Christian Brauner
2026-08-31 13:08       ` Tao Cui [this message]
2026-08-28 13:34   ` Bradley Morgan
2026-08-31 10:12 ` (subset) [PATCH 0/2] userns: clean up dead code on error paths Christian Brauner

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=5d152da3-bdda-4a3c-8067-f3a8b7d9f786@linux.dev \
    --to=cui.tao@linux.dev \
    --cc=brads@mainlining.org \
    --cc=brauner@kernel.org \
    --cc=containers@vger.kernel.org \
    --cc=cuitao@kylinos.cn \
    --cc=cyphar@cyphar.com \
    --cc=jack@suse.cz \
    --cc=kees@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.