linux/drivers/nvme/target
Daniel Wagner 85428beac8 nvmet: seset ns->file when open fails
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:

static u16 nvmet_parse_io_cmd(struct nvmet_req *req)
{
	[...]

	if (req->ns->file)
		return nvmet_file_parse_io_cmd(req);

	return nvmet_bdev_parse_io_cmd(req);
}

Reported-by: Enzo Matsumiya <ematsumiya@suse.com>
Signed-off-by: Daniel Wagner <dwagner@suse.de>
Signed-off-by: Christoph Hellwig <hch@lst.de>
2021-05-12 19:48:48 +02:00
..
admin-cmd.c nvmet: use helper to remove the duplicate code 2021-05-11 18:30:45 +02:00
configfs.c nvmet: fix a spelling mistake "nubmer" -> "number" 2021-04-15 08:12:53 +02:00
core.c for-5.13/drivers-2021-04-27 2021-04-28 14:39:37 -07:00
discovery.c nvmet: demote discovery cmd parse err msg to debug 2021-05-11 18:30:45 +02:00
fabrics-cmd.c nvmet: demote fabrics cmd parse err msg to debug 2021-05-11 18:30:46 +02:00
fc.c nvmet-fc: simplify nvmet_fc_alloc_hostport 2021-04-15 08:12:53 +02:00
fcloop.c nvme: constify static attribute_group structs 2021-02-02 10:26:10 +01:00
io-cmd-bdev.c nvmet: fix inline bio check for bdev-ns 2021-05-11 18:30:45 +02:00
io-cmd-file.c nvmet: seset ns->file when open fails 2021-05-12 19:48:48 +02:00
Kconfig nvmet: fix a spelling mistake "incuding" -> "including" in Kconfig 2020-12-01 20:36:37 +01:00
loop.c nvme: move the fabrics queue ready check routines to core 2021-05-04 09:35:49 +02:00
Makefile nvmet: add passthru code to process commands 2020-07-29 07:45:21 +02:00
nvmet.h nvmet: fix inline bio check for bdev-ns 2021-05-11 18:30:45 +02:00
passthru.c nvmet: fix inline bio check for passthru 2021-05-11 18:30:45 +02:00
rdma.c nvmet-rdma: Fix NULL deref when SEND is completed with error 2021-05-11 18:30:45 +02:00
tcp.c for-5.13/drivers-2021-04-27 2021-04-28 14:39:37 -07:00
trace.c nvmet: trace: parse Get LBA Status command in detail 2019-08-29 12:55:01 -07:00
trace.h nvmet: use min of device_path and disk len 2021-02-10 16:38:05 +01:00