tipc: correctly handle releasing a not fully initialized sock
Commit f2f9800d49
"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>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
86cfeab6b5
commit
357c4774b5
|
@ -470,8 +470,8 @@ static void tipc_sk_callback(struct rcu_head *head)
|
||||||
static int tipc_release(struct socket *sock)
|
static int tipc_release(struct socket *sock)
|
||||||
{
|
{
|
||||||
struct sock *sk = sock->sk;
|
struct sock *sk = sock->sk;
|
||||||
struct net *net = sock_net(sk);
|
struct net *net;
|
||||||
struct tipc_net *tn = net_generic(net, tipc_net_id);
|
struct tipc_net *tn;
|
||||||
struct tipc_sock *tsk;
|
struct tipc_sock *tsk;
|
||||||
struct sk_buff *skb;
|
struct sk_buff *skb;
|
||||||
u32 dnode, probing_state;
|
u32 dnode, probing_state;
|
||||||
|
@ -483,6 +483,9 @@ static int tipc_release(struct socket *sock)
|
||||||
if (sk == NULL)
|
if (sk == NULL)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
net = sock_net(sk);
|
||||||
|
tn = net_generic(net, tipc_net_id);
|
||||||
|
|
||||||
tsk = tipc_sk(sk);
|
tsk = tipc_sk(sk);
|
||||||
lock_sock(sk);
|
lock_sock(sk);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue