Skip to content

Commit fa3c411

Browse files
Tetsuo Handarleon
authored andcommitted
RDMA/core: always drop device refcount in ib_del_sub_device_and_put()
Since nldev_deldev() (introduced by commit 060c642 ("RDMA/nldev: Add support to add/delete a sub IB device through netlink") grabs a reference using ib_device_get_by_index() before calling ib_del_sub_device_and_put(), we need to drop that reference before returning -EOPNOTSUPP error. Reported-by: [email protected] Closes: https://syzkaller.appspot.com/bug?extid=881d65229ca4f9ae8c84 Fixes: bca5119 ("RDMA/core: Support IB sub device with type "SMI"") Signed-off-by: Tetsuo Handa <[email protected]> Link: https://patch.msgid.link/[email protected] Reviewed-by: Parav Pandit <[email protected]> Signed-off-by: Leon Romanovsky <[email protected]>
1 parent de41cbc commit fa3c411

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

drivers/infiniband/core/device.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2881,8 +2881,10 @@ int ib_del_sub_device_and_put(struct ib_device *sub)
28812881
{
28822882
struct ib_device *parent = sub->parent;
28832883

2884-
if (!parent)
2884+
if (!parent) {
2885+
ib_device_put(sub);
28852886
return -EOPNOTSUPP;
2887+
}
28862888

28872889
mutex_lock(&parent->subdev_lock);
28882890
list_del(&sub->subdev_list);

0 commit comments

Comments
 (0)