* [PATCH] Bluetooth: Fix use after free in l2cap_chan_timeout
@ 2015-03-19 8:19 Harish Jenny K N
2015-03-19 14:59 ` Sergei Shtylyov
0 siblings, 1 reply; 4+ 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] 4+ messages in thread
* Re: [PATCH] Bluetooth: Fix use after free in l2cap_chan_timeout
2015-03-19 8:19 [PATCH] Bluetooth: Fix use after free in l2cap_chan_timeout Harish Jenny K N
@ 2015-03-19 14:59 ` Sergei Shtylyov
0 siblings, 0 replies; 4+ messages in thread
From: Sergei Shtylyov @ 2015-03-19 14:59 UTC (permalink / raw)
To: Harish Jenny K N, marcel
Cc: gustavo, johan.hedberg, davem, linux-bluetooth, netdev,
linux-kernel
Hello.
On 3/19/2015 11:19 AM, Harish Jenny K N wrote:
> 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);
> + }
> +
{} not needed here.
[...]
WBR, Sergei
^ permalink raw reply [flat|nested] 4+ messages in thread
* [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; 4+ 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] 4+ messages in thread
* Re: [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, 0 replies; 4+ messages in thread
From: Sergei Shtylyov @ 2015-03-18 14:22 UTC (permalink / raw)
To: Harish Jenny K N, marcel
Cc: gustavo, johan.hedberg, davem, linux-bluetooth, netdev,
linux-kernel
Hello.
On 3/18/2015 2:59 PM, Harish Jenny K N wrote:
> 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)) &&
Note that parens around == are unnecessary.
> + chan->chan_type == L2CAP_CHAN_CONN_ORIENTED) {
> + chan->ops->teardown(chan, 0);
> + }
> +
[...]
WBR, Sergei
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2015-03-19 14:59 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-03-19 8:19 [PATCH] Bluetooth: Fix use after free in l2cap_chan_timeout Harish Jenny K N
2015-03-19 14:59 ` Sergei Shtylyov
-- strict thread matches above, loose matches on Subject: below --
2015-03-18 11:59 Harish Jenny K N
2015-03-18 14:22 ` Sergei Shtylyov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).