]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
RDMA/core: always drop device refcount in ib_del_sub_device_and_put()
authorTetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Sat, 20 Dec 2025 02:11:33 +0000 (11:11 +0900)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 8 Jan 2026 09:16:50 +0000 (10:16 +0100)
commitfe8d456080423b9ed410469fbd1e2098d3acce2b
tree3a01b03c3767d20c02fc62885195dba0939332f1
parentb20d6455f5372171cc3f2cc40763393f384433ea
RDMA/core: always drop device refcount in ib_del_sub_device_and_put()

[ Upstream commit fa3c411d21ebc26ffd175c7256c37cefa35020aa ]

Since nldev_deldev() (introduced by commit 060c642b2ab8 ("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: syzbot+881d65229ca4f9ae8c84@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=881d65229ca4f9ae8c84
Fixes: bca51197620a ("RDMA/core: Support IB sub device with type "SMI"")
Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Link: https://patch.msgid.link/80749a85-cbe2-460c-8451-42516013f9fa@I-love.SAKURA.ne.jp
Reviewed-by: Parav Pandit <parav@nvidia.com>
Signed-off-by: Leon Romanovsky <leon@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/infiniband/core/device.c