From: Sasha Levin <sasha.levin@oracle.com>
To: linux-kernel@vger.kernel.org
Cc: ying.xue@windriver.com, Tero.Aho@coriant.com,
jon.maloy@ericsson.com, Sasha Levin <sasha.levin@oracle.com>,
Allan Stephens <allan.stephens@windriver.com>,
"David S. Miller" <davem@davemloft.net>,
netdev@vger.kernel.org (open list:TIPC NETWORK LAYER),
tipc-discussion@lists.sourceforge.net (open list:TIPC NETWORK
LAYER)
Subject: [PATCH] tipc: correctly handle releasing a not fully initialized sock
Date: Tue, 13 Jan 2015 12:46:41 -0500 [thread overview]
Message-ID: <1421171201-25224-1-git-send-email-sasha.levin@oracle.com> (raw)
Commit "tipc: make tipc node table aware of net namespace" has added a
dereference of sock->sk before making sure it's not NULL, which makes
releasing a tipc socket NULL pointer dereference for sockets that are
not fully initialized.
Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
---
net/tipc/socket.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/net/tipc/socket.c b/net/tipc/socket.c
index 2cec496..694d436 100644
--- a/net/tipc/socket.c
+++ b/net/tipc/socket.c
@@ -472,8 +472,8 @@ static void tipc_sk_callback(struct rcu_head *head)
static int tipc_release(struct socket *sock)
{
struct sock *sk = sock->sk;
- struct net *net = sock_net(sk);
- struct tipc_net *tn = net_generic(net, tipc_net_id);
+ struct net *net;
+ struct tipc_net *tn;
struct tipc_sock *tsk;
struct sk_buff *skb;
u32 dnode, probing_state;
@@ -485,6 +485,9 @@ static int tipc_release(struct socket *sock)
if (sk == NULL)
return 0;
+ net = sock_net(sk);
+ tn = net_generic(net, tipc_net_id);
+
tsk = tipc_sk(sk);
lock_sock(sk);
--
1.7.10.4
next reply other threads:[~2015-01-13 17:46 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-01-13 17:46 Sasha Levin [this message]
2015-01-13 22:25 ` [PATCH] tipc: correctly handle releasing a not fully initialized sock David Miller
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=1421171201-25224-1-git-send-email-sasha.levin@oracle.com \
--to=sasha.levin@oracle.com \
--cc=Tero.Aho@coriant.com \
--cc=allan.stephens@windriver.com \
--cc=davem@davemloft.net \
--cc=jon.maloy@ericsson.com \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--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 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).