[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1421171201-25224-1-git-send-email-sasha.levin@oracle.com>
Date: Tue, 13 Jan 2015 12:46:41 -0500
From: Sasha Levin <sasha.levin@...cle.com>
To: linux-kernel@...r.kernel.org
Cc: ying.xue@...driver.com, Tero.Aho@...iant.com,
jon.maloy@...csson.com, Sasha Levin <sasha.levin@...cle.com>,
Allan Stephens <allan.stephens@...driver.com>,
"David S. Miller" <davem@...emloft.net>,
netdev@...r.kernel.org (open list:TIPC NETWORK LAYER),
tipc-discussion@...ts.sourceforge.net (open list:TIPC NETWORK LAYER)
Subject: [PATCH] tipc: correctly handle releasing a not fully initialized sock
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@...cle.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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists