[PATCH] RDMA/siw: fix a refcount leak in siw_newlink()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



siw_newlink() is leaking a refcount on "base_dev" when kzalloc() from
_ib_alloc_device() from ib_alloc_device() from siw_device_create()
returned NULL.

Signed-off-by: Tetsuo Handa <penguin-kernel@xxxxxxxxxxxxxxxxxxx>
Fixes: bdcf26bf9b3a ("rdma/siw: network and RDMA core interface")
---
I don't know whether this is a bug syzbot is currently reporting at
https://syzkaller.appspot.com/bug?extid=5e70d01ee8985ae62a3b .
Please check if this patch helps.

 drivers/infiniband/sw/siw/siw_main.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/infiniband/sw/siw/siw_main.c b/drivers/infiniband/sw/siw/siw_main.c
index dacc174604bf..aefeda633655 100644
--- a/drivers/infiniband/sw/siw/siw_main.c
+++ b/drivers/infiniband/sw/siw/siw_main.c
@@ -522,6 +522,8 @@ static int siw_newlink(const char *basedev_name, struct net_device *netdev)
 		rv = siw_device_register(sdev, basedev_name);
 		if (rv)
 			ib_dealloc_device(&sdev->base_dev);
+	} else {
+		ib_device_put(base_dev);
 	}
 	return rv;
 }
-- 
2.18.4



[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Yosemite Photos]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux