[bug report] kmemleak observed with blktests nvme-tcp tests

Sagi Grimberg sagi at grimberg.me
Thu Sep 30 07:07:34 PDT 2021


> Bisect shows it was introduced from the below commit:
> 
> commit 2637baed78010eeaae274feb5b99ce90933fadfb
> Author: Minwoo Im <minwoo.im.dev at gmail.com>
> Date:   Wed Apr 21 16:45:04 2021 +0900
> 
>      nvme: introduce generic per-namespace chardev
> 

Makes sense as both leaks relate to the nshead cdev...

I think another put on the cdev_device is missing?
--
diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index 1d103ae4afdf..328e314af199 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -3668,6 +3668,7 @@ void nvme_cdev_del(struct cdev *cdev, struct 
device *cdev_device)
  {
         cdev_device_del(cdev, cdev_device);
         ida_simple_remove(&nvme_ns_chr_minor_ida, 
MINOR(cdev_device->devt));
+       put_device(cdev_device);
  }

  int nvme_cdev_add(struct cdev *cdev, struct device *cdev_device,
--



More information about the Linux-nvme mailing list