All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Bluetooth: Fix use after free in l2cap_chan_timeout
@ 2015-03-18 11:59 Harish Jenny K N
  2015-03-18 14:22 ` Sergei Shtylyov
  0 siblings, 1 reply; 8+ messages in thread
From: Harish Jenny K N @ 2015-03-18 11:59 UTC (permalink / raw)
  To: marcel
  Cc: gustavo, johan.hedberg, davem, linux-bluetooth, netdev, linux-kernel

There is a potential use after free in bt_sock_poll when a
socket gets killed without getting unlinked from accept_q.
Hence added code to unlink from accpept_q by calling teardown
before freeing the socket for channel type L2CAP_CHAN_CONN_ORIENTED.

Signed-off-by: Harish Jenny K N <harish_kandiga@mentor.com>
---
 net/bluetooth/l2cap_core.c |    5 +++++
 1 file changed, 5 insertions(+)

diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c
index 6ba33f9..3c3421e 100644
--- a/net/bluetooth/l2cap_core.c
+++ b/net/bluetooth/l2cap_core.c
@@ -415,6 +415,11 @@ static void l2cap_chan_timeout(struct work_struct *work)
 
 	l2cap_chan_close(chan, reason);
 
+	if (((chan->state == BT_CONNECTED) || (chan->state == BT_CONFIG)) &&
+	    chan->chan_type == L2CAP_CHAN_CONN_ORIENTED) {
+		chan->ops->teardown(chan, 0);
+	}
+
 	l2cap_chan_unlock(chan);
 
 	chan->ops->close(chan);
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 8+ messages in thread
* [PATCH] Bluetooth: Fix use after free in l2cap_chan_timeout
@ 2015-03-19  8:19 Harish Jenny K N
  2015-03-19  8:25 ` Johan Hedberg
  2015-03-19 14:59 ` Sergei Shtylyov
  0 siblings, 2 replies; 8+ messages in thread
From: Harish Jenny K N @ 2015-03-19  8:19 UTC (permalink / raw)
  To: marcel
  Cc: gustavo, johan.hedberg, davem, linux-bluetooth, netdev,
	linux-kernel, harish_kandiga

There is a potential use after free in bt_sock_poll when a
socket gets killed without getting unlinked from accept_q.
Hence added code to unlink from accpept_q by calling teardown
before freeing the socket for channel type L2CAP_CHAN_CONN_ORIENTED.

Signed-off-by: Harish Jenny K N <harish_kandiga@mentor.com>
---
 net/bluetooth/l2cap_core.c |    5 +++++
 1 file changed, 5 insertions(+)

diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c
index 6ba33f9..c6955fb 100644
--- a/net/bluetooth/l2cap_core.c
+++ b/net/bluetooth/l2cap_core.c
@@ -415,6 +415,11 @@ static void l2cap_chan_timeout(struct work_struct *work)
 
 	l2cap_chan_close(chan, reason);
 
+	if ((chan->state == BT_CONNECTED || chan->state == BT_CONFIG) &&
+	    chan->chan_type == L2CAP_CHAN_CONN_ORIENTED) {
+		chan->ops->teardown(chan, 0);
+	}
+
 	l2cap_chan_unlock(chan);
 
 	chan->ops->close(chan);
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 8+ messages in thread
* [PATCH] Bluetooth: Fix use after free in l2cap_chan_timeout
@ 2015-03-26  9:10 Harish Jenny K N
  0 siblings, 0 replies; 8+ messages in thread
From: Harish Jenny K N @ 2015-03-26  9:10 UTC (permalink / raw)
  To: marcel; +Cc: gustavo, johan.hedberg, davem, linux-bluetooth, harish_kandiga

There is a potential use after free in bt_sock_poll when a
socket gets killed without getting unlinked from accept_q.
Hence added code to unlink from accpept_q by calling teardown
before freeing the socket for channel type L2CAP_CHAN_CONN_ORIENTED.

Signed-off-by: Harish Jenny K N <harish_kandiga@mentor.com>
---
 net/bluetooth/l2cap_core.c |    4 ++++
 1 file changed, 4 insertions(+)

diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c
index 6ba33f9..3e273e6 100644
--- a/net/bluetooth/l2cap_core.c
+++ b/net/bluetooth/l2cap_core.c
@@ -415,6 +415,10 @@ static void l2cap_chan_timeout(struct work_struct *work)
 
 	l2cap_chan_close(chan, reason);
 
+	if ((chan->state == BT_CONNECTED || chan->state == BT_CONFIG) &&
+	    chan->chan_type == L2CAP_CHAN_CONN_ORIENTED)
+		chan->ops->teardown(chan, 0);
+
 	l2cap_chan_unlock(chan);
 
 	chan->ops->close(chan);
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2015-03-26  9:10 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-18 11:59 [PATCH] Bluetooth: Fix use after free in l2cap_chan_timeout Harish Jenny K N
2015-03-18 14:22 ` Sergei Shtylyov
2015-03-19  8:19 Harish Jenny K N
2015-03-19  8:25 ` Johan Hedberg
2015-03-19  8:57   ` Harish Jenny Kandiga Nagaraj
2015-03-19  8:59   ` Harish Jenny Kandiga Nagaraj
2015-03-19 14:59 ` Sergei Shtylyov
2015-03-26  9:10 Harish Jenny K N

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.