linux-stable/drivers/nvme/target
Maurizio Lombardi 50632b877c nvmet-tcp: fix kernel crash if commands allocation fails
[ Upstream commit 5572a55a6f ]

If the commands allocation fails in nvmet_tcp_alloc_cmds()
the kernel crashes in nvmet_tcp_release_queue_work() because of
a NULL pointer dereference.

  nvmet: failed to install queue 0 cntlid 1 ret 6
  Unable to handle kernel NULL pointer dereference at
         virtual address 0000000000000008

Fix the bug by setting queue->nr_cmds to zero in case
nvmet_tcp_alloc_cmd() fails.

Fixes: 872d26a391 ("nvmet-tcp: add NVMe over TCP target driver")
Signed-off-by: Maurizio Lombardi <mlombard@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Keith Busch <kbusch@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-09-12 11:06:51 +02:00
..
admin-cmd.c
configfs.c nvmet: fix ns enable/disable possible hang 2024-06-16 13:32:28 +02:00
core.c nvmet: fix a possible leak when destroy a ctrl during qp establishment 2024-07-18 13:05:45 +02:00
discovery.c
fabrics-cmd.c nvmet: nul-terminate the NQNs passed in the connect command 2023-12-08 08:46:09 +01:00
fc.c nvmet-fc: abort command when there is no binding 2024-03-01 13:16:45 +01:00
fcloop.c nvmet-fcloop: swap the list_add_tail arguments 2024-03-01 13:16:45 +01:00
io-cmd-bdev.c
io-cmd-file.c
Kconfig
loop.c
Makefile
nvmet.h nvmet: remove unnecessary ctrl parameter 2023-12-08 08:46:09 +01:00
passthru.c nvmet: don't defer passthrough commands with trivial effects to the workqueue 2023-01-14 10:16:25 +01:00
rdma.c nvmet-rdma: fix possible bad dereference when freeing rsps 2024-09-04 13:17:39 +02:00
tcp.c nvmet-tcp: fix kernel crash if commands allocation fails 2024-09-12 11:06:51 +02:00
trace.c nvmet-trace: avoid dereferencing pointer too early 2024-09-04 13:17:35 +02:00
trace.h nvmet-trace: avoid dereferencing pointer too early 2024-09-04 13:17:35 +02:00