* [PATCH] tipc: correctly handle releasing a not fully initialized sock
@ 2015-01-13 17:46 Sasha Levin
2015-01-13 22:25 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Sasha Levin @ 2015-01-13 17:46 UTC (permalink / raw)
To: linux-kernel
Cc: ying.xue, Tero.Aho, jon.maloy, Sasha Levin, Allan Stephens,
David S. Miller, open list:TIPC NETWORK LAYER,
open list:TIPC NETWORK LAYER
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
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH] tipc: correctly handle releasing a not fully initialized sock
2015-01-13 17:46 [PATCH] tipc: correctly handle releasing a not fully initialized sock Sasha Levin
@ 2015-01-13 22:25 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2015-01-13 22:25 UTC (permalink / raw)
To: sasha.levin
Cc: linux-kernel, ying.xue, Tero.Aho, jon.maloy, allan.stephens,
netdev, tipc-discussion
From: Sasha Levin <sasha.levin@oracle.com>
Date: Tue, 13 Jan 2015 12:46:41 -0500
> 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>
Good catch, applied, thanks.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-01-13 22:25 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-01-13 17:46 [PATCH] tipc: correctly handle releasing a not fully initialized sock Sasha Levin
2015-01-13 22:25 ` David Miller
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).