|
@@ -2434,6 +2434,14 @@ int l2cap_chan_send(struct l2cap_chan *chan, struct msghdr *msg, size_t len,
|
|
|
if (IS_ERR(skb))
|
|
|
return PTR_ERR(skb);
|
|
|
|
|
|
+ /* Channel lock is released before requesting new skb and then
|
|
|
+ * reacquired thus we need to recheck channel state.
|
|
|
+ */
|
|
|
+ if (chan->state != BT_CONNECTED) {
|
|
|
+ kfree_skb(skb);
|
|
|
+ return -ENOTCONN;
|
|
|
+ }
|
|
|
+
|
|
|
l2cap_do_send(chan, skb);
|
|
|
return len;
|
|
|
}
|
|
@@ -2483,6 +2491,14 @@ int l2cap_chan_send(struct l2cap_chan *chan, struct msghdr *msg, size_t len,
|
|
|
if (IS_ERR(skb))
|
|
|
return PTR_ERR(skb);
|
|
|
|
|
|
+ /* Channel lock is released before requesting new skb and then
|
|
|
+ * reacquired thus we need to recheck channel state.
|
|
|
+ */
|
|
|
+ if (chan->state != BT_CONNECTED) {
|
|
|
+ kfree_skb(skb);
|
|
|
+ return -ENOTCONN;
|
|
|
+ }
|
|
|
+
|
|
|
l2cap_do_send(chan, skb);
|
|
|
err = len;
|
|
|
break;
|