Unverified Commit 68f265f5 authored by openeuler-ci-bot's avatar openeuler-ci-bot Committed by Gitee
Browse files

!11221 apparmor: Fix null pointer deref when receiving skb during sock creation

parents 7c48e108 e9b5f8ad
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -1048,6 +1048,13 @@ static int apparmor_socket_sock_rcv_skb(struct sock *sk, struct sk_buff *skb)
	if (!skb->secmark)
		return 0;

	/*
	 * If reach here before socket_post_create hook is called, in which
	 * case label is null, drop the packet.
	 */
	if (!ctx->label)
		return -EACCES;

	return apparmor_secmark_check(ctx->label, OP_RECVMSG, AA_MAY_RECEIVE,
				      skb->secmark, sk);
}