From: Chuck Lever Date: Mon, 12 Aug 2024 15:47:57 +0000 (-0400) Subject: rpcrdma: Device kref is over-incremented on error from xa_alloc X-Git-Tag: v6.11-rc5~9^2~7 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=de48aad2a8e80ba026ca91c383f590f0bf97b3c0;p=thirdparty%2Fkernel%2Flinux.git rpcrdma: Device kref is over-incremented on error from xa_alloc If the device's reference count is too high, the device completion callback never fires. Signed-off-by: Chuck Lever Signed-off-by: Anna Schumaker --- diff --git a/net/sunrpc/xprtrdma/ib_client.c b/net/sunrpc/xprtrdma/ib_client.c index a938c19c3490d..4d1e9fa89573e 100644 --- a/net/sunrpc/xprtrdma/ib_client.c +++ b/net/sunrpc/xprtrdma/ib_client.c @@ -62,9 +62,9 @@ int rpcrdma_rn_register(struct ib_device *device, if (!rd || test_bit(RPCRDMA_RD_F_REMOVING, &rd->rd_flags)) return -ENETUNREACH; - kref_get(&rd->rd_kref); if (xa_alloc(&rd->rd_xa, &rn->rn_index, rn, xa_limit_32b, GFP_KERNEL) < 0) return -ENOMEM; + kref_get(&rd->rd_kref); rn->rn_done = done; return 0; }