From: Tung Quang Nguyen <tung.q.nguyen@dektech.com.au>
To: Hangyu Hua <hbh25y@gmail.com>
Cc: "netdev@vger.kernel.org" <netdev@vger.kernel.org>,
"tipc-discussion@lists.sourceforge.net"
<tipc-discussion@lists.sourceforge.net>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"jmaloy@redhat.com" <jmaloy@redhat.com>,
"ying.xue@windriver.com" <ying.xue@windriver.com>,
"davem@davemloft.net" <davem@davemloft.net>,
"edumazet@google.com" <edumazet@google.com>,
"kuba@kernel.org" <kuba@kernel.org>,
"pabeni@redhat.com" <pabeni@redhat.com>
Subject: RE: [PATCH v2] net: tipc: fix possible refcount leak in tipc_sk_create()
Date: Wed, 29 Jun 2022 09:52:45 +0000 [thread overview]
Message-ID: <DB9PR05MB90784623C9C6206C3C44980288BB9@DB9PR05MB9078.eurprd05.prod.outlook.com> (raw)
In-Reply-To: <20220629063418.21620-1-hbh25y@gmail.com>
> Subject: [PATCH v2] net: tipc: fix possible refcount leak in tipc_sk_create()
>
> Free sk in case tipc_sk_insert() fails.
>
> Signed-off-by: Hangyu Hua <hbh25y@gmail.com>
> ---
>
> v2: use a succinct commit log.
>
> net/tipc/socket.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/net/tipc/socket.c b/net/tipc/socket.c
> index 17f8c523e33b..43509c7e90fc 100644
> --- a/net/tipc/socket.c
> +++ b/net/tipc/socket.c
> @@ -502,6 +502,7 @@ static int tipc_sk_create(struct net *net, struct socket *sock,
> sock_init_data(sock, sk);
> tipc_set_sk_state(sk, TIPC_OPEN);
> if (tipc_sk_insert(tsk)) {
> + sk_free(sk);
> pr_warn("Socket create failed; port number exhausted\n");
> return -EINVAL;
> }
> --
> 2.25.1
Reviewed-by: Tung Nguyen <tung.q.nguyen@dektech.com.au>
next prev parent reply other threads:[~2022-06-29 9:52 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-29 6:34 [PATCH v2] net: tipc: fix possible refcount leak in tipc_sk_create() Hangyu Hua
2022-06-29 9:52 ` Tung Quang Nguyen [this message]
2022-06-29 13:00 ` patchwork-bot+netdevbpf
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=DB9PR05MB90784623C9C6206C3C44980288BB9@DB9PR05MB9078.eurprd05.prod.outlook.com \
--to=tung.q.nguyen@dektech.com.au \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=hbh25y@gmail.com \
--cc=jmaloy@redhat.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=tipc-discussion@lists.sourceforge.net \
--cc=ying.xue@windriver.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.