Skip to contentSkip to conversation

Bluetooth: Remove double free of skb pointer

PATCH In review Andrei Emeltchenko 3 participants 3 messages Dec 22, 2009 – Jan 7, 2010

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Bluetooth: Remove double free of skb pointer

Trivial fix for double free of skb pointer with kfree_skb to make code simplier and cleaner. Remove unused variable err.

---
 net/bluetooth/l2cap.c |   11 ++++-------
 1 files changed, 4 insertions(+), 7 deletions(-)
net/bluetooth/l2cap.c +0 -0
index 1120cf1..8acc19e 100644
@@ -3518,7 +3518,6 @@ static inline int l2cap_data_channel(struct

l2cap_conn *conn, u16 cid, struct sk
struct l2cap_pinfo *pi;
u16 control, len;
u8 tx_seq;
- int err;

sk = l2cap_get_chan_by_scid(&conn->chan_list, cid); if (!sk) {
@@ -3570,13 +3569,11 @@ static inline int l2cap_data_channel(struct l2cap_conn *conn, u16 cid, struct sk
goto drop;

if (__is_iframe(control))
- err = l2cap_data_channel_iframe(sk, control, skb);
+ l2cap_data_channel_iframe(sk, control, skb);
else
- err = l2cap_data_channel_sframe(sk, control, skb);
+ l2cap_data_channel_sframe(sk, control, skb);

- if (!err)
- goto done;
- break;
+ goto done;

case L2CAP_MODE_STREAMING:
control = get_unaligned_le16(skb->data);
@@ -3602,7 +3599,7 @@ static inline int l2cap_data_channel(struct l2cap_conn *conn, u16 cid, struct sk
else
pi->expected_tx_seq = tx_seq + 1;

- err = l2cap_sar_reassembly_sdu(sk, skb, control);
+ l2cap_sar_reassembly_sdu(sk, skb, control);

goto done;

Signature · 1 line
1.6.0.4

From b1a7a03ae566416636f443f3d201dc745dfeb0b7 Mon Sep 17 00:00:00 2001
From: Andrei Emeltchenko <[email protected]>
Date: Tue, 22 Dec 2009 15:58:08 +0200
Subject: [PATCH] Bluetooth: Remove double free of skb pointer

Trivial fix for double free of skb pointer with kfree_skb to make code simplier and cleaner. Remove unused variable err.

---
 net/bluetooth/l2cap.c |   11 ++++-------
 1 files changed, 4 insertions(+), 7 deletions(-)
net/bluetooth/l2cap.c +4 -7
index 1120cf1..8acc19e 100644
@@ -3518,7 +3518,6 @@ static inline int l2cap_data_channel(struct l2cap_conn *conn, u16 cid, struct sk
 	struct l2cap_pinfo *pi;
 	u16 control, len;
 	u8 tx_seq;
-	int err;
 
 	sk = l2cap_get_chan_by_scid(&conn->chan_list, cid);
 	if (!sk) {
@@ -3570,13 +3569,11 @@ static inline int l2cap_data_channel(struct l2cap_conn *conn, u16 cid, struct sk
 			goto drop;
 
 		if (__is_iframe(control))
-			err = l2cap_data_channel_iframe(sk, control, skb);
+			l2cap_data_channel_iframe(sk, control, skb);
 		else
-			err = l2cap_data_channel_sframe(sk, control, skb);
+			l2cap_data_channel_sframe(sk, control, skb);
 
-		if (!err)
-			goto done;
-		break;
+		goto done;
 
 	case L2CAP_MODE_STREAMING:
 		control = get_unaligned_le16(skb->data);
@@ -3602,7 +3599,7 @@ static inline int l2cap_data_channel(struct l2cap_conn *conn, u16 cid, struct sk
 		else
 			pi->expected_tx_seq = tx_seq + 1;
 
-		err = l2cap_sar_reassembly_sdu(sk, skb, control);
+		l2cap_sar_reassembly_sdu(sk, skb, control);
 
 		goto done;
 
Signature · 1 line
1.6.0.4
Acked-by on v1 1/1
#1 lore raw
Quoted 44 lines · Andrei Emeltchenko

Trivial fix for double free of skb pointer with kfree_skb to make code simplier and cleaner. Remove unused variable err.

---
 net/bluetooth/l2cap.c |   11 ++++-------

 1 files changed, 4 insertions(+), 7 deletions(-)
net/bluetooth/l2cap.c +0 -0
index 1120cf1..8acc19e 100644
@@ -3518,7 +3518,6 @@ static inline int l2cap_data_channel(struct

l2cap_conn *conn, u16 cid, struct sk
       struct l2cap_pinfo *pi;
       u16 control, len;
       u8 tx_seq;
-       int err;

       sk = l2cap_get_chan_by_scid(&conn->chan_list, cid); if (!sk) {

net/bluetooth/l2cap.c +0 -0
@@ -3570,13 +3569,11 @@ static inline int l2cap_data_channel(struct

l2cap_conn *conn, u16 cid, struct sk
                       goto drop;

               if (__is_iframe(control))
-                       err = l2cap_data_channel_iframe(sk, control, skb);
+                       l2cap_data_channel_iframe(sk, control, skb); else
-                       err = l2cap_data_channel_sframe(sk, control, skb);
+                       l2cap_data_channel_sframe(sk, control, skb);

-               if (!err)
-                       goto done;
-               break;
+               goto done;

       case L2CAP_MODE_STREAMING:
               control = get_unaligned_le16(skb->data);

net/bluetooth/l2cap.c +0 -0
@@ -3602,7 +3599,7 @@ static inline int l2cap_data_channel(struct

l2cap_conn *conn, u16 cid, struct sk
               else
                       pi->expected_tx_seq = tx_seq + 1;

Quoted 8 lines

-               err = l2cap_sar_reassembly_sdu(sk, skb, control);
+               l2cap_sar_reassembly_sdu(sk, skb, control);

               goto done;

--
1.6.0.4

Signature · 2 lines
Gustavo F. Padovan
http://padovan.org
maintainer
#2 lore raw
In reply to Andrei Emeltchenko

Hi Andrei,

Quoted 2 lines

Trivial fix for double free of skb pointer with kfree_skb to make code simplier and cleaner. Remove unused variable err.

patch has been applied. Thanks.

Regards

Marcel