diff options
author | Gustavo Padovan <gustavo.padovan@collabora.co.uk> | 2013-10-21 16:22:25 -0400 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2013-10-21 16:50:55 -0400 |
commit | 7f5396a774997a24e2adaffd973cfa5bd2b3e665 (patch) | |
tree | 12de86590df4f1576a26d16c07e379eaa03e4eec /net/bluetooth | |
parent | 0e790c64f37a1a43c147720bdfa03b7c5538e24a (diff) |
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: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'net/bluetooth')
-rw-r--r-- | net/bluetooth/l2cap_core.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c index bb6d35e6b832..0cef67707838 100644 --- a/net/bluetooth/l2cap_core.c +++ b/net/bluetooth/l2cap_core.c | |||
@@ -2813,17 +2813,16 @@ static void l2cap_raw_recv(struct l2cap_conn *conn, struct sk_buff *skb) | |||
2813 | mutex_lock(&conn->chan_lock); | 2813 | mutex_lock(&conn->chan_lock); |
2814 | 2814 | ||
2815 | list_for_each_entry(chan, &conn->chan_l, list) { | 2815 | list_for_each_entry(chan, &conn->chan_l, list) { |
2816 | struct sock *sk = chan->sk; | ||
2817 | if (chan->chan_type != L2CAP_CHAN_RAW) | 2816 | if (chan->chan_type != L2CAP_CHAN_RAW) |
2818 | continue; | 2817 | continue; |
2819 | 2818 | ||
2820 | /* Don't send frame to the socket it came from */ | 2819 | /* Don't send frame to the channel it came from */ |
2821 | if (skb->sk == sk) | 2820 | if (bt_cb(skb)->chan == chan) |
2822 | continue; | 2821 | continue; |
2822 | |||
2823 | nskb = skb_clone(skb, GFP_KERNEL); | 2823 | nskb = skb_clone(skb, GFP_KERNEL); |
2824 | if (!nskb) | 2824 | if (!nskb) |
2825 | continue; | 2825 | continue; |
2826 | |||
2827 | if (chan->ops->recv(chan, nskb)) | 2826 | if (chan->ops->recv(chan, nskb)) |
2828 | kfree_skb(nskb); | 2827 | kfree_skb(nskb); |
2829 | } | 2828 | } |