Commit 7f5396a7 authored by Gustavo Padovan's avatar Gustavo Padovan Committed by Marcel Holtmann

Bluetooth: Use bt_cb(skb)->chan to send raw data back

Instead of accessing skb->sk in L2CAP core we now compare the channel
a skb belongs to and not send it back if the channel is same. This change
removes another struct socket usage from L2CAP core.
Signed-off-by: default avatarGustavo Padovan <gustavo.padovan@collabora.co.uk>
Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
parent 0e790c64
...@@ -2813,17 +2813,16 @@ static void l2cap_raw_recv(struct l2cap_conn *conn, struct sk_buff *skb) ...@@ -2813,17 +2813,16 @@ static void l2cap_raw_recv(struct l2cap_conn *conn, struct sk_buff *skb)
mutex_lock(&conn->chan_lock); mutex_lock(&conn->chan_lock);
list_for_each_entry(chan, &conn->chan_l, list) { list_for_each_entry(chan, &conn->chan_l, list) {
struct sock *sk = chan->sk;
if (chan->chan_type != L2CAP_CHAN_RAW) if (chan->chan_type != L2CAP_CHAN_RAW)
continue; continue;
/* Don't send frame to the socket it came from */ /* Don't send frame to the channel it came from */
if (skb->sk == sk) if (bt_cb(skb)->chan == chan)
continue; continue;
nskb = skb_clone(skb, GFP_KERNEL); nskb = skb_clone(skb, GFP_KERNEL);
if (!nskb) if (!nskb)
continue; continue;
if (chan->ops->recv(chan, nskb)) if (chan->ops->recv(chan, nskb))
kfree_skb(nskb); kfree_skb(nskb);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment