linux/drivers/nvme/host
Guoqing Jiang 3596a06583 nvme: fix potential memory leaks in nvme_cdev_add
We need to call put_device if cdev_device_add failed, otherwise
kmemleak has below report.

[<0000000024c71758>] kmem_cache_alloc_trace+0x233/0x480
[<00000000ad2813ed>] device_add+0x7ff/0xe10
[<0000000035bc54c4>] cdev_device_add+0x72/0xa0
[<000000006c9aa1e8>] nvme_cdev_add+0xa9/0xf0 [nvme_core]
[<000000003c4d492d>] nvme_mpath_set_live+0x251/0x290 [nvme_core]
[<00000000889a58da>] nvme_mpath_add_disk+0x268/0x320 [nvme_core]
[<00000000192e7161>] nvme_alloc_ns+0x669/0xac0 [nvme_core]
[<000000007a1a6041>] nvme_validate_or_alloc_ns+0x156/0x280 [nvme_core]
[<000000003a763c35>] nvme_scan_work+0x221/0x3c0 [nvme_core]
[<000000009ff10706>] process_one_work+0x5cf/0xb10
[<000000000644ee25>] worker_thread+0x7a/0x680
[<00000000285ebd2f>] kthread+0x1c6/0x210
[<00000000e297c6ea>] ret_from_fork+0x22/0x30

Fixes: 2637baed78 ("nvme: introduce generic per-namespace chardev")
Signed-off-by: Guoqing Jiang <jiangguoqing@kylinos.cn>
Reviewed-by: Javier González <javier.gonz@samsung.com>
Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
Reviewed-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
2021-05-25 09:21:15 +02:00
..
core.c nvme: fix potential memory leaks in nvme_cdev_add 2021-05-25 09:21:15 +02:00
fabrics.c nvme: move the fabrics queue ready check routines to core 2021-05-04 09:35:49 +02:00
fabrics.h nvme: move the fabrics queue ready check routines to core 2021-05-04 09:35:49 +02:00
fault_inject.c
fc.c nvme-fc: clear q_live at beginning of association teardown 2021-05-19 08:40:24 +02:00
fc.h
hwmon.c nvme-hwmon: Return error code when registration fails 2021-03-05 13:41:03 +01:00
ioctl.c nvme: fix controller ioctl through ns_head 2021-05-04 09:35:47 +02:00
Kconfig nvme-tcp: fix kconfig dependency warning when !CRYPTO 2020-09-15 07:58:49 +02:00
lightnvm.c for-5.13/drivers-2021-04-27 2021-04-28 14:39:37 -07:00
Makefile nvme: move the ioctl code to a separate file 2021-04-15 08:12:55 +02:00
multipath.c nvmet: use new ana_log_size instead the old one 2021-05-13 16:33:32 +02:00
nvme.h nvme-multipath: fix double initialization of ANA state 2021-05-11 18:30:45 +02:00
pci.c nvme-pci: fix controller reset hang when racing with nvme_timeout 2021-05-04 09:35:50 +02:00
rdma.c nvme: move the fabrics queue ready check routines to core 2021-05-04 09:35:49 +02:00
tcp.c nvme-tcp: rerun io_work if req_list is not empty 2021-05-19 08:33:42 +02:00
trace.c nvme: add tracing of zns commands 2021-02-02 10:26:12 +01:00
trace.h
zns.c nvme: let namespace probing continue for unsupported features 2021-04-15 08:12:56 +02:00