mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Aayush Agarwal <aayush.a.agarwal@oracle.com>
To: unlisted-recipients:; (no To-header on input)
Cc: aayush.a.agarwal@oracle.com, stable@vger.kernel.org,
	Hangyu Hua <hbh25y@gmail.com>, Jakub Kicinski <kuba@kernel.org>,
	Remi Denis-Courmont <courmisch@gmail.com>,
	"David S. Miller" <davem@davemloft.net>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH 4.14] phonet: refcount leak in pep_sock_accep
Date: Fri,  7 Jan 2022 02:53:32 -0800	[thread overview]
Message-ID: <20220107105332.61347-1-aayush.a.agarwal@oracle.com> (raw)

From: Hangyu Hua <hbh25y@gmail.com>

commit bcd0f9335332 ("phonet: refcount leak in pep_sock_accep")
upstream.

sock_hold(sk) is invoked in pep_sock_accept(), but __sock_put(sk) is not
invoked in subsequent failure branches(pep_accept_conn() != 0).

Signed-off-by: Hangyu Hua <hbh25y@gmail.com>
Link: https://lore.kernel.org/r/20211209082839.33985-1-hbh25y@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Aayush Agarwal <aayush.a.agarwal@oracle.com>
---
 net/phonet/pep.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/net/phonet/pep.c b/net/phonet/pep.c
index b0d958cd1823..4c4a8a42ee88 100644
--- a/net/phonet/pep.c
+++ b/net/phonet/pep.c
@@ -881,6 +881,7 @@ static struct sock *pep_sock_accept(struct sock *sk, int flags, int *errp,
 
 	err = pep_accept_conn(newsk, skb);
 	if (err) {
+		__sock_put(sk);
 		sock_put(newsk);
 		newsk = NULL;
 		goto drop;
-- 
2.27.0


             reply	other threads:[~2022-01-07 10:53 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-07 10:53 Aayush Agarwal [this message]
2022-01-07 11:24 ` Greg KH
2022-01-07 16:54   ` [External] : " aayush.a.agarwal
2022-01-09 13:00     ` Greg KH

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=20220107105332.61347-1-aayush.a.agarwal@oracle.com \
    --to=aayush.a.agarwal@oracle.com \
    --cc=courmisch@gmail.com \
    --cc=davem@davemloft.net \
    --cc=hbh25y@gmail.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®