All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
To: Harish Jenny K N <harish_kandiga@mentor.com>, marcel@holtmann.org
Cc: gustavo@padovan.org, johan.hedberg@gmail.com,
	davem@davemloft.net, linux-bluetooth@vger.kernel.org,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] Bluetooth: Fix use after free in l2cap_chan_timeout
Date: Wed, 18 Mar 2015 17:22:36 +0300	[thread overview]
Message-ID: <55098A2C.50905@cogentembedded.com> (raw)
In-Reply-To: <1426679940-20710-1-git-send-email-harish_kandiga@mentor.com>

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

  reply	other threads:[~2015-03-18 14:22 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
  -- strict thread matches above, loose matches on Subject: below --
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=55098A2C.50905@cogentembedded.com \
    --to=sergei.shtylyov@cogentembedded.com \
    --cc=davem@davemloft.net \
    --cc=gustavo@padovan.org \
    --cc=harish_kandiga@mentor.com \
    --cc=johan.hedberg@gmail.com \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marcel@holtmann.org \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.