diff options
| author | Linux Build Service Account <lnxbuild@localhost> | 2018-07-12 20:13:12 -0700 |
|---|---|---|
| committer | Gerrit - the friendly Code Review server <code-review@localhost> | 2018-07-12 20:13:12 -0700 |
| commit | e5020c202481fab4273f5d48c0ba0bb59e0cc9a8 (patch) | |
| tree | ec451ed62a3154a905c8bccf752e29a2bea443d2 | |
| parent | 348619f43fbc336b16006d83f192ded71355ee92 (diff) | |
| parent | 074c25bf9fd80e13e23217d906580e1bc7d5a2ef (diff) | |
Merge "net: core: null pointer derefernce in sockev_client_cb"
| -rw-r--r-- | net/core/sockev_nlmcast.c | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/net/core/sockev_nlmcast.c b/net/core/sockev_nlmcast.c index 88bb4117b41b..bade2d2596f7 100644 --- a/net/core/sockev_nlmcast.c +++ b/net/core/sockev_nlmcast.c @@ -70,14 +70,17 @@ static int sockev_client_cb(struct notifier_block *nb, struct nlmsghdr *nlh; struct sknlsockevmsg *smsg; struct socket *sock; + struct sock *sk; sock = (struct socket *)data; - if (socknlmsgsk == 0) + if (!socknlmsgsk || !sock) goto done; - if ((!socknlmsgsk) || (!sock) || (!sock->sk)) + + sk = sock->sk; + if (!sk) goto done; - if (sock->sk->sk_family != AF_INET && sock->sk->sk_family != AF_INET6) + if (sk->sk_family != AF_INET && sk->sk_family != AF_INET6) goto done; if (event != SOCKEV_BIND && event != SOCKEV_LISTEN) @@ -98,12 +101,11 @@ static int sockev_client_cb(struct notifier_block *nb, smsg = nlmsg_data(nlh); smsg->pid = current->pid; _sockev_event(event, smsg->event, sizeof(smsg->event)); - smsg->skfamily = sock->sk->sk_family; - smsg->skstate = sock->sk->sk_state; - smsg->skprotocol = sock->sk->sk_protocol; - smsg->sktype = sock->sk->sk_type; - smsg->skflags = sock->sk->sk_flags; - + smsg->skfamily = sk->sk_family; + smsg->skstate = sk->sk_state; + smsg->skprotocol = sk->sk_protocol; + smsg->sktype = sk->sk_type; + smsg->skflags = sk->sk_flags; nlmsg_notify(socknlmsgsk, skb, 0, SKNLGRP_SOCKEV, 0, GFP_KERNEL); done: return 0; |
