From: Cyrill Gorcunov <gorcunov@openvz.org>
To: netdev@vger.kernel.org
Cc: Eric Dumazet <eric.dumazet@gmail.com>,
"David S. Miller" <davem@davemloft.net>,
David Ahern <dsa@cumulusnetworks.com>,
Andrey Vagin <avagin@openvz.org>,
Stephen Hemminger <stephen@networkplumber.org>,
Cyrill Gorcunov <gorcunov@openvz.org>
Subject: [patch net-next 1/2] [PATCH] net: ip, raw_diag -- Fix socket leaking for destroy request
Date: Wed, 02 Nov 2016 15:36:31 +0300 [thread overview]
Message-ID: <20161102125454.694582296@openvz.org> (raw)
[-- Attachment #1: inet-diag-raw-add-sock_put --]
[-- Type: text/plain, Size: 986 bytes --]
In raw_diag_destroy the helper raw_sock_get returns
with sock_hold call, so we have to put it then.
CC: David S. Miller <davem@davemloft.net>
CC: Eric Dumazet <eric.dumazet@gmail.com>
CC: David Ahern <dsa@cumulusnetworks.com>
CC: Andrey Vagin <avagin@openvz.org>
CC: Stephen Hemminger <stephen@networkplumber.org>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
---
net/ipv4/raw_diag.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
Index: linux-ml.git/net/ipv4/raw_diag.c
===================================================================
--- linux-ml.git.orig/net/ipv4/raw_diag.c
+++ linux-ml.git/net/ipv4/raw_diag.c
@@ -205,11 +205,14 @@ static int raw_diag_destroy(struct sk_bu
{
struct net *net = sock_net(in_skb->sk);
struct sock *sk;
+ int err;
sk = raw_sock_get(net, r);
if (IS_ERR(sk))
return PTR_ERR(sk);
- return sock_diag_destroy(sk, ECONNABORTED);
+ err = sock_diag_destroy(sk, ECONNABORTED);
+ sock_put(sk);
+ return err;
}
#endif
next reply other threads:[~2016-11-02 12:56 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-11-02 12:36 Cyrill Gorcunov [this message]
2016-11-02 14:56 ` [patch net-next 1/2] [PATCH] net: ip, raw_diag -- Fix socket leaking for destroy request David Ahern
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=20161102125454.694582296@openvz.org \
--to=gorcunov@openvz.org \
--cc=avagin@openvz.org \
--cc=davem@davemloft.net \
--cc=dsa@cumulusnetworks.com \
--cc=eric.dumazet@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=stephen@networkplumber.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;
as well as URLs for NNTP newsgroup(s).