Skip to contentSkip to conversation

Bluetooth: fix crash in L2CAP

PATCH In review Gustavo F. Padovan 2 participants 5 messages Oct 21, 2010 – Oct 29, 2010

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

cover Bluetooth: fix crash in L2CAP

Hi Greg,

The following patch is good for 2.6.36.1. It arrived too late in linux-bluetooth and we didn't had time to put it into 2.6.36. It fixes a serious crash into the L2CAP layer. The issue isn't in 2.6.35 and below.

Thanks.

Nathan Holstein (1):
Bluetooth: fix oops in l2cap_connect_req

 net/bluetooth/l2cap.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
Signature · 1 line
1.7.3.1
#1 lore raw

PATCH 1/1 Bluetooth: fix oops in l2cap_connect_req

From: Nathan Holstein <[email protected]>

In error cases when the ACL is insecure or we fail to allocate a new struct sock, we jump to the "response" label. If so, "sk" will be null and the kernel crashes.

---
 net/bluetooth/l2cap.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
net/bluetooth/l2cap.c +2 -2
index 0b54b7d..dc60205 100644
@@ -2891,7 +2891,7 @@ static inline int l2cap_connect_req(struct l2cap_conn *conn, struct l2cap_cmd_hd
 	struct l2cap_chan_list *list = &conn->chan_list;
 	struct l2cap_conn_req *req = (struct l2cap_conn_req *) data;
 	struct l2cap_conn_rsp rsp;
-	struct sock *parent, *uninitialized_var(sk);
+	struct sock *parent, *sk = NULL;
 	int result, status = L2CAP_CS_NO_INFO;
 
 	u16 dcid = 0, scid = __le16_to_cpu(req->scid);
@@ -3000,7 +3000,7 @@ sendresp:
 					L2CAP_INFO_REQ, sizeof(info), &info);
 	}
 
-	if (!(l2cap_pi(sk)->conf_state & L2CAP_CONF_REQ_SENT) &&
+	if (sk && !(l2cap_pi(sk)->conf_state & L2CAP_CONF_REQ_SENT) &&
 				result == L2CAP_CR_SUCCESS) {
 		u8 buf[128];
 		l2cap_pi(sk)->conf_state |= L2CAP_CONF_REQ_SENT;
Signature · 1 line
1.7.3.1
#2 lore raw
In reply to Gustavo F. Padovan
Quoted 5 lines · Gustavo F. Padovan

Hi Greg,

The following patch is good for 2.6.36.1. It arrived too late in linux-bluetooth and we didn't had time to put it into 2.6.36. It fixes a serious crash into the L2CAP layer. The issue isn't in 2.6.35 and below.

It needs to get into Linus's tree before I can accept it into the -stable trees. Please get it there and then send [email protected] the git commit id and I will add it.

Instructions on how to do this are in the file, Documentation/stable_kernel_rules.txt. Please read that for how to properly do this.

thanks,

greg k-h

#3 lore raw

Hi Greg,

Quoted 10 lines · Greg KH
Quoted 5 lines · Gustavo F. Padovan

Hi Greg,

The following patch is good for 2.6.36.1. It arrived too late in linux-bluetooth and we didn't had time to put it into 2.6.36. It fixes a serious crash into the L2CAP layer. The issue isn't in 2.6.35 and below.

It needs to get into Linus's tree before I can accept it into the -stable trees. Please get it there and then send [email protected] the git commit id and I will add it.

It is now on Linus' tree, sorry for doing this wrong first time. It was my first report to stable. ;)

commit d793fe8caa3911e6a1e826b45d4ee00d250cdec8

Signature · 2 lines
Gustavo F. Padovan
ProFUSION embedded systems - http://profusion.mobi
#4 lore raw
Quoted 11 lines · Gustavo F. Padovan

Hi Greg,

Quoted 7 lines · Greg KH
Quoted 5 lines · Gustavo F. Padovan

Hi Greg,

The following patch is good for 2.6.36.1. It arrived too late in linux-bluetooth and we didn't had time to put it into 2.6.36. It fixes a serious crash into the L2CAP layer. The issue isn't in 2.6.35 and below.

Quoted 6 lines
Quoted 3 lines

It needs to get into Linus's tree before I can accept it into the -stable trees. Please get it there and then send [email protected] the git commit id and I will add it.

It is now on Linus' tree, sorry for doing this wrong first time. It was my first report to stable. ;)

No problem.

Quoted 1 line

commit d793fe8caa3911e6a1e826b45d4ee00d250cdec8

Now queued up, thanks.

greg k-h