lkml.org 
[lkml]   [2011]   [Mar]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Date
    SubjectRe: [PATCH] work around for l2cap NULL dereference in l2cap_conn_start
    From
    Hi all,

    I don't have an S305 headset at the moment to play with this, but, our
    tree (2.6.36) has
    a fix like this for this issue.


    if (bt_sk(sk)->defer_setup) {
    struct sock *parent = bt_sk(sk)->parent;
    rsp.result = cpu_to_le16(L2CAP_CR_PEND);
    rsp.status = cpu_to_le16(L2CAP_CS_AUTHOR_PEND);
    - parent->sk_data_ready(parent, 0);
    + if (parent)
    + parent->sk_data_ready(parent, 0);

    } else {
    sk->sk_state = BT_CONFIG;
    rsp.result = cpu_to_le16(L2CAP_CR_SUCCESS);

    The comment is:

    Bluetooth: Hack: Don't dereference null pointer.

    This avoids the S305 panic during incoming connection.

    S305 sends PSM 25 L2CAP connection request before the L2CAP info response.
    When we receive that info response we crash on null pointer here.

    Sorry for the wait,
    A

    On Sun, Feb 20, 2011 at 10:36 PM, David Fries <david@fries.net> wrote:
    > bt_sk(sk)->parent can be NULL in l2cap_conn_start in state BT_CONNECT2
    > at least when a headset device pairs and the play button was pressed
    > right before pairing.
    >
    > Signed-off-by: David Fries <david@fries.net>
    > ---
    > I removed the printk, can this be merged to the bluetooth next tree?
    >
    > On Mon, Feb 14, 2011 at 03:40:46PM -0600, Andrei Warkentin wrote:
    >> FWIW still need it in 2.6.36.
    >
    > Andrei, I'm curious, what's your hardware hardware and bluetooth
    > device that's trigginer the crash?
    >
    >> On Mon, Feb 14, 2011 at 8:56 AM, Gustavo F. Padovan
    >> <padovan@profusion.mobi> wrote:
    >> > Hi David,
    >> >
    >> > * David Fries <david@fries.net> [2011-02-10 21:53:09 -0600]:
    >> >
    >> >> Here's a patch to avoid a very repeatable crash in the N900.  If I
    >> >> take a Motorola S305 bluetooth headset that was previously paried with
    >> >> the N900, turn it on, and press the play button before the headphones
    >> >> automatically pair with the cell phone, the N900 will crash (and
    >> >> reboot) in pairing.  If I wait until after they have paired there
    >> >> isn't any problem.  The patch is against the kernel-power
    >> >> 2.6.28-maemo46 by Thomas Tanner, the stock Nokia PR1.2 oops looked
    >> >> the same, I just haven't gone back to that kernel.
    >> >
    >> > This is a very old kernel. You need to check this issue against
    >> > bluetooth-next-2.6.
    >
    >  net/bluetooth/l2cap.c |    3 ++-
    >  1 files changed, 2 insertions(+), 1 deletions(-)
    >
    > diff --git a/net/bluetooth/l2cap.c b/net/bluetooth/l2cap.c
    > index ed83c1f..a7aa4d9 100644
    > --- a/net/bluetooth/l2cap.c
    > +++ b/net/bluetooth/l2cap.c
    > @@ -408,7 +408,8 @@ static void l2cap_conn_start(struct l2cap_conn *conn)
    >                                        struct sock *parent = bt_sk(sk)->parent;
    >                                        rsp.result = cpu_to_le16(L2CAP_CR_PEND);
    >                                        rsp.status = cpu_to_le16(L2CAP_CS_AUTHOR_PEND);
    > -                                       parent->sk_data_ready(parent, 0);
    > +                                       if(parent)
    > +                                               parent->sk_data_ready(parent,0);
    >
    >                                } else {
    >                                        sk->sk_state = BT_CONFIG;
    > --
    > 1.7.2.3
    >
    >
    --
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/

    \
     
     \ /
      Last update: 2011-03-02 03:01    [W:2.615 / U:0.168 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site