Unverified Commit 82d575a1 authored by openeuler-ci-bot's avatar openeuler-ci-bot Committed by Gitee
Browse files

!14635 Bluetooth: RFCOMM: avoid leaving dangling sk pointer in rfcomm_sock_alloc()

parents 0094f7d8 5eba5b9a
Loading
Loading
Loading
Loading
+5 −5
Original line number Diff line number Diff line
@@ -274,13 +274,13 @@ static struct sock *rfcomm_sock_alloc(struct net *net, struct socket *sock,
	struct rfcomm_dlc *d;
	struct sock *sk;

	sk = bt_sock_alloc(net, sock, &rfcomm_proto, proto, prio, kern);
	if (!sk)
	d = rfcomm_dlc_alloc(prio);
	if (!d)
		return NULL;

	d = rfcomm_dlc_alloc(prio);
	if (!d) {
		sk_free(sk);
	sk = bt_sock_alloc(net, sock, &rfcomm_proto, proto, prio, kern);
	if (!sk) {
		rfcomm_dlc_free(d);
		return NULL;
	}