SUNRPC: Fix missing release socket in rpc_sockname()
authorWang ShaoBo <bobo.shaobowang@huawei.com>
Thu, 24 Nov 2022 09:23:42 +0000 (17:23 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 18 Jan 2023 08:26:16 +0000 (09:26 +0100)
[ Upstream commit 50fa355bc0d75911fe9d5072a5ba52cdb803aff7 ]

socket dynamically created is not released when getting an unintended
address family type in rpc_sockname(), direct to out_release for calling
sock_release().

Fixes: 2e738fdce22f ("SUNRPC: Add API to acquire source address")
Signed-off-by: Wang ShaoBo <bobo.shaobowang@huawei.com>
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
net/sunrpc/clnt.c

index 9259529e0412f0ec9539f1aa3f696fe0b85f7ae3..411925b043ccef63416502b5549bee2f7f27c052 100644 (file)
@@ -1267,7 +1267,7 @@ static int rpc_sockname(struct net *net, struct sockaddr *sap, size_t salen,
                break;
        default:
                err = -EAFNOSUPPORT;
-               goto out;
+               goto out_release;
        }
        if (err < 0) {
                dprintk("RPC:       can't bind UDP socket (%d)\n", err);