]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-client.git/commit
net: mctp: fix device leak on probe failure
authorJohan Hovold <johan@kernel.org>
Thu, 5 Mar 2026 10:45:49 +0000 (11:45 +0100)
committerJakub Kicinski <kuba@kernel.org>
Fri, 6 Mar 2026 23:38:21 +0000 (15:38 -0800)
commit224a0d284c3caf1951302d1744a714784febed71
tree0792f8fb20938b0d81d4b71d10db3a12e5674fda
parent0e16181704e37330069c24cea143f15b7b298da3
net: mctp: fix device leak on probe failure

Driver core holds a reference to the USB interface and its parent USB
device while the interface is bound to a driver and there is no need to
take additional references unless the structures are needed after
disconnect.

This driver takes a reference to the USB device during probe but does
not to release it on probe failures.

Drop the redundant device reference to fix the leak, reduce cargo
culting, make it easier to spot drivers where an extra reference is
needed, and reduce the risk of further memory leaks.

Fixes: 0791c0327a6e ("net: mctp: Add MCTP USB transport driver")
Cc: stable@vger.kernel.org # 6.15
Signed-off-by: Johan Hovold <johan@kernel.org>
Acked-by: Jeremy Kerr <jk@codeconstruct.com.au>
Link: https://patch.msgid.link/20260305104549.16110-1-johan@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/mctp/mctp-usb.c