Unverified Commit 25fd923e authored by openeuler-ci-bot's avatar openeuler-ci-bot Committed by Gitee
Browse files

!14810 af_packet: avoid erroring out after sock_init_data() in packet_create()

parents a3384275 afe628c5
Loading
Loading
Loading
Loading
+6 −6
Original line number Diff line number Diff line
@@ -3321,18 +3321,18 @@ static int packet_create(struct net *net, struct socket *sock, int protocol,
	if (sock->type == SOCK_PACKET)
		sock->ops = &packet_ops_spkt;

	po = pkt_sk(sk);
	err = packet_alloc_pending(po);
	if (err)
		goto out_sk_free;

	sock_init_data(sock, sk);

	po = pkt_sk(sk);
	init_completion(&po->skb_completion);
	sk->sk_family = PF_PACKET;
	po->num = proto;
	po->xmit = dev_queue_xmit;

	err = packet_alloc_pending(po);
	if (err)
		goto out2;

	packet_cached_dev_reset(po);

	sk->sk_destruct = packet_sock_destruct;
@@ -3367,7 +3367,7 @@ static int packet_create(struct net *net, struct socket *sock, int protocol,
	preempt_enable();

	return 0;
out2:
out_sk_free:
	sk_free(sk);
out:
	return err;