Re: [PATCH AUTOSEL 5.4 2/2] nvmet: seset ns->file when open fails

From: Chaitanya Kulkarni
Date: Tue May 18 2021 - 00:27:41 EST


Sasha,

On 5/17/21 18:20, Sasha Levin wrote:
> From: Daniel Wagner <dwagner@xxxxxxx>
>
> [ Upstream commit 85428beac80dbcace5b146b218697c73e367dcf5 ]
>
> Reset the ns->file value to NULL also in the error case in
> nvmet_file_ns_enable().
>
> The ns->file variable points either to file object or contains the
> error code after the filp_open() call. This can lead to following
> problem:
>
> When the user first setups an invalid file backend and tries to enable
> the ns, it will fail. Then the user switches over to a bdev backend
> and enables successfully the ns. The first received I/O will crash the
> system because the IO backend is chosen based on the ns->file value:

I think the patch subject line is being worked on since it needs to be
reset and not seset.

Not sure how we can go about fixing that.