1
0
Fork 0
alistair23-linux/drivers/nvme/host
zhenwei pi 8c9c034325 nvme-rdma: handle unexpected nvme completion data length
[ Upstream commit 25c1ca6eca ]

Receiving a zero length message leads to the following warnings because
the CQE is processed twice:

refcount_t: underflow; use-after-free.
WARNING: CPU: 0 PID: 0 at lib/refcount.c:28

RIP: 0010:refcount_warn_saturate+0xd9/0xe0
Call Trace:
 <IRQ>
 nvme_rdma_recv_done+0xf3/0x280 [nvme_rdma]
 __ib_process_cq+0x76/0x150 [ib_core]
 ...

Sanity check the received data length, to avoids this.

Thanks to Chao Leng & Sagi for suggestions.

Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2020-11-10 12:37:30 +01:00
..
Kconfig nvme-tcp: fix kconfig dependency warning when !CRYPTO 2020-10-01 13:18:19 +02:00
Makefile nvme-tcp: add NVMe over TCP host driver 2018-12-13 09:58:58 +01:00
core.c nvme-core: put ctrl ref when module ref get fail 2020-10-14 10:33:00 +02:00
fabrics.c nvme-fabrics: don't check state NVME_CTRL_NEW for request acceptance 2020-09-17 13:47:47 +02:00
fabrics.h nvme: Remove ADMIN_ONLY state 2019-10-14 23:21:44 +09:00
fault_inject.c nvme: enable to inject errors into admin commands 2019-06-21 11:15:50 +02:00
fc.c nvme-fc: fail new connections to a deleted host or remote port 2020-10-07 08:01:27 +02:00
lightnvm.c lightnvm: move metadata mapping to lower level driver 2019-08-06 08:20:10 -06:00
multipath.c nvme-multipath: do not reset on unknown status 2020-10-01 13:17:49 +02:00
nvme.h nvme: consolidate chunk_sectors settings 2020-10-07 08:01:30 +02:00
pci.c nvme-pci: disable the write zeros command for Intel 600P/P3100 2020-10-29 09:57:25 +01:00
rdma.c nvme-rdma: handle unexpected nvme completion data length 2020-11-10 12:37:30 +01:00
tcp.c nvme-tcp: check page by sendpage_ok() before calling kernel_sendpage() 2020-10-14 10:33:01 +02:00
trace.c nvme: trace: parse Get LBA Status command in detail 2019-08-29 12:55:01 -07:00
trace.h nvme-trace: print result and status in hex format 2019-06-21 11:12:37 +02:00