Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 33dd6983 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "net: core: null pointer derefernce in sockev_client_cb"

parents 41cdfe20 7332b16b
Loading
Loading
Loading
Loading
+11 −9
Original line number Diff line number Diff line
@@ -69,14 +69,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 == NULL) || (sock == NULL) || (sock->sk == NULL))

	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,
	memset(smsg, 0, sizeof(struct sknlsockevmsg));
	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;