linux-stable/drivers
Max Gurtovoy bcd9a0797d nvmet: fix freeing unallocated p2pmem
In case p2p device was found but the p2p pool is empty, the nvme target
is still trying to free the sgl from the p2p pool instead of the
regular sgl pool and causing a crash (BUG() is called). Instead, assign
the p2p_dev for the request only if it was allocated from p2p pool.

This is the crash that was caused:

[Sun May 30 19:13:53 2021] ------------[ cut here ]------------
[Sun May 30 19:13:53 2021] kernel BUG at lib/genalloc.c:518!
[Sun May 30 19:13:53 2021] invalid opcode: 0000 [#1] SMP PTI
...
[Sun May 30 19:13:53 2021] kernel BUG at lib/genalloc.c:518!
...
[Sun May 30 19:13:53 2021] RIP: 0010:gen_pool_free_owner+0xa8/0xb0
...
[Sun May 30 19:13:53 2021] Call Trace:
[Sun May 30 19:13:53 2021] ------------[ cut here ]------------
[Sun May 30 19:13:53 2021]  pci_free_p2pmem+0x2b/0x70
[Sun May 30 19:13:53 2021]  pci_p2pmem_free_sgl+0x4f/0x80
[Sun May 30 19:13:53 2021]  nvmet_req_free_sgls+0x1e/0x80 [nvmet]
[Sun May 30 19:13:53 2021] kernel BUG at lib/genalloc.c:518!
[Sun May 30 19:13:53 2021]  nvmet_rdma_release_rsp+0x4e/0x1f0 [nvmet_rdma]
[Sun May 30 19:13:53 2021]  nvmet_rdma_send_done+0x1c/0x60 [nvmet_rdma]

Fixes: c6e3f13398 ("nvmet: add metadata support for block devices")
Reviewed-by: Israel Rukshin <israelr@nvidia.com>
Signed-off-by: Max Gurtovoy <mgurtovoy@nvidia.com>
Reviewed-by: Logan Gunthorpe <logang@deltatee.com>
Reviewed-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
2021-06-02 10:10:38 +03:00
..
accessibility TTY/Serial driver updates for 5.13-rc1 2021-04-26 11:20:10 -07:00
acpi CFI on arm64 series for v5.13-rc1 2021-04-27 10:16:46 -07:00
amba
android selinux/stable-5.13 PR 20210426 2021-04-27 13:42:11 -07:00
ata SCSI misc on 20210428 2021-04-28 17:22:10 -07:00
atm The usual updates from the irq departement: 2021-04-26 09:43:16 -07:00
auxdisplay
base regmap: Updates for v5.13 2021-04-26 16:21:16 -07:00
bcma
block nbd: share nbd_put and return by goto put_nbd 2021-05-12 08:42:43 -06:00
bluetooth TTY/Serial driver updates for 5.13-rc1 2021-04-26 11:20:10 -07:00
bus ARM: SoC drivers for v5.13 2021-04-26 12:11:52 -07:00
cdrom gdrom: fix compilation error 2021-04-11 19:32:06 -06:00
char A bunch of little cleanups 2021-04-28 15:54:57 -07:00
clk Here's a collection of largely clk driver updates for the merge window. The 2021-04-28 17:13:56 -07:00
clocksource ARM: platform support for Apple M1 2021-04-26 12:30:36 -07:00
comedi staging: comedi: move out of staging directory 2021-04-15 09:26:25 +02:00
connector
counter
cpufreq Power management updates for 5.13-rc1 2021-04-26 15:10:25 -07:00
cpuidle Merge back earlier cpuidle updates for v5.13. 2021-04-08 20:05:49 +02:00
crypto Merge branch 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6 2021-04-26 08:51:23 -07:00
cxl cxl/mem: Fix memory device capacity probing 2021-04-16 18:21:56 -07:00
dax
dca
devfreq PM / devfreq: imx8m-ddrc: Remove unneeded of_match_ptr() 2021-04-08 13:14:51 +09:00
dio
dma ARM: SoC drivers for v5.13 2021-04-26 12:11:52 -07:00
dma-buf drm/syncobj: use newly allocated stub fences 2021-04-08 12:21:13 +02:00
edac
eisa
extcon - Core Frameworks 2021-04-28 15:59:13 -07:00
firewire The usual updates from the irq departement: 2021-04-26 09:43:16 -07:00
firmware - removed get_fs/set_fs 2021-04-29 11:28:08 -07:00
fpga ARM: SoC drivers for v5.13 2021-04-26 12:11:52 -07:00
fsi
gnss
gpio - Core Frameworks 2021-04-28 15:59:13 -07:00
gpu VFIO updates for v5.13-rc1 2021-04-28 17:19:47 -07:00
greybus greybus: es2: fix kernel-doc warnings 2021-04-16 07:26:50 +02:00
hid
hsi HSI: core: fix resource leaks in hsi_add_client_from_dt() 2021-04-16 00:14:49 +02:00
hv printk changes for 5.13 2021-04-27 18:09:44 -07:00
hwmon ACPI updates for 5.13-rc1 2021-04-26 15:03:23 -07:00
hwspinlock
hwtracing coresight: etm-perf: Fix define build issue when built as module 2021-04-16 09:34:57 +02:00
i2c - Core Frameworks 2021-04-28 15:59:13 -07:00
i3c
ide
idle intel_idle: add Iclelake-D support 2021-04-08 19:18:07 +02:00
iio spi: Updates for v5.13 2021-04-26 16:32:11 -07:00
infiniband RDMA/rtrs: fix uninitialized symbol 'cnt' 2021-05-03 11:00:11 -06:00
input - Core Frameworks 2021-04-28 15:59:13 -07:00
interconnect CFI on arm64 series for v5.13-rc1 2021-04-27 10:16:46 -07:00
iommu
ipack
irqchip - removed get_fs/set_fs 2021-04-29 11:28:08 -07:00
isdn
leds treewide: change my e-mail address, fix my name 2021-04-09 14:54:23 -07:00
lightnvm lightnvm: deprecated OCSSD support and schedule it for removal in Linux 5.15 2021-04-13 09:16:12 -06:00
macintosh
mailbox - qcom: enable support for SM8350 and SC7280 2021-04-28 16:10:33 -07:00
mcb
md md/raid5: remove an incorrect assert in in_chunk_boundary 2021-05-25 18:03:15 -07:00
media drm for 5.13-rc1 2021-04-28 10:01:40 -07:00
memory Power management updates for 5.13-rc1 2021-04-26 15:10:25 -07:00
memstick memstick: r592: ignore kfifo_out() return code again 2021-04-26 11:08:23 +02:00
message scsi: message: fusion: Remove unused local variable 'vtarget' 2021-04-13 01:39:12 -04:00
mfd - Core Frameworks 2021-04-28 15:59:13 -07:00
misc CFI on arm64 series for v5.13-rc1 2021-04-27 10:16:46 -07:00
mmc MMC core: 2021-04-28 15:56:51 -07:00
most Staging/IIO driver updates for 5.13-rc1 2021-04-26 11:14:21 -07:00
mtd printk changes for 5.13 2021-04-27 18:09:44 -07:00
mux
net Locking changes for this cycle were: 2021-04-28 12:37:53 -07:00
nfc
ntb
nubus
nvdimm libnvdimm/region: Fix nvdimm_has_flush() to handle ND_REGION_ASYNC 2021-04-09 21:56:01 -07:00
nvme nvmet: fix freeing unallocated p2pmem 2021-06-02 10:10:38 +03:00
nvmem
of Devicetree updates for v5.13: 2021-04-28 15:50:24 -07:00
opp
parisc
parport
pci s390 updates for 5.13 merge window 2021-04-27 17:54:15 -07:00
pcmcia
perf
phy phy: Revert "phy: ti: j721e-wiz: add missing of_node_put" 2021-04-16 07:27:37 +02:00
pinctrl ARM: SoC drivers for v5.13 2021-04-26 12:11:52 -07:00
platform USB/Thunderbolt patches for 5.13-rc1 2021-04-26 11:32:23 -07:00
pnp
power power supply and reset changes for the v5.13 series 2021-04-28 15:43:58 -07:00
powercap
pps TTY/Serial driver updates for 5.13-rc1 2021-04-26 11:20:10 -07:00
ps3
ptp
pwm - Core Frameworks 2021-04-28 15:59:13 -07:00
rapidio
ras
regulator - Core Frameworks 2021-04-28 15:59:13 -07:00
remoteproc
reset ARM SCMI updates for v5.13 2021-04-08 17:38:20 +02:00
rpmsg
rtc - Core Frameworks 2021-04-28 15:59:13 -07:00
s390 s390/dasd: add missing discipline function 2021-05-25 12:54:00 -06:00
sbus
scsi SCSI misc on 20210428 2021-04-28 17:22:10 -07:00
sh The usual updates from the irq departement: 2021-04-26 09:43:16 -07:00
siox
slimbus
soc ARM: SoC drivers for v5.13 2021-04-26 12:11:52 -07:00
soundwire
spi CFI on arm64 series for v5.13-rc1 2021-04-27 10:16:46 -07:00
spmi
ssb
staging Here's a collection of largely clk driver updates for the merge window. The 2021-04-28 17:13:56 -07:00
target SCSI misc on 20210428 2021-04-28 17:22:10 -07:00
tc
tee ARM: SoC drivers for v5.13 2021-04-26 12:11:52 -07:00
thermal
thunderbolt thunderbolt: Changes for v5.13 merge window 2021-04-13 12:17:14 +02:00
tty Power management updates for 5.13-rc1 2021-04-26 15:10:25 -07:00
uio
usb SCSI misc on 20210428 2021-04-28 17:22:10 -07:00
vdpa vdpa/mlx5: Set err = -ENOMEM in case dma_map_sg_attrs fails 2021-04-22 18:15:31 -04:00
vfio VFIO updates for v5.13-rc1 2021-04-28 17:19:47 -07:00
vhost SCSI misc on 20210428 2021-04-28 17:22:10 -07:00
video - New Device Support 2021-04-28 16:02:58 -07:00
virt
virtio
visorbus
vlynq
vme
w1 w1: ds28e17: Use module_w1_family to simplify the code 2021-04-10 10:58:21 +02:00
watchdog - Core Frameworks 2021-04-28 15:59:13 -07:00
xen SCSI misc on 20210428 2021-04-28 17:22:10 -07:00
zorro
Kconfig staging: comedi: move out of staging directory 2021-04-15 09:26:25 +02:00
Makefile staging: comedi: move out of staging directory 2021-04-15 09:26:25 +02:00