aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorAndrei Emeltchenko <andrei.emeltchenko@intel.com>2011-10-11 06:37:48 -0400
committerGustavo F. Padovan <padovan@profusion.mobi>2011-10-13 15:45:10 -0400
commit793c2f1cb9d722231290daf1744e6c5b7269f445 (patch)
treeb46ea72bcadbce72fd76241f852bdc2d358a4c4a /net
parentfb45de7dbaf2cf8eec43a88bdb98889f0d4d5d5f (diff)
Bluetooth: EWS: rewrite check frame type function
Check frame function uses now information about control field type. Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com> Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Diffstat (limited to 'net')
-rw-r--r--net/bluetooth/l2cap_core.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c
index 1c367d6af995..9262a00bce55 100644
--- a/net/bluetooth/l2cap_core.c
+++ b/net/bluetooth/l2cap_core.c
@@ -578,7 +578,8 @@ static inline void l2cap_send_sframe(struct l2cap_chan *chan, u16 control)
578 BT_DBG("chan %p, control 0x%2.2x", chan, control); 578 BT_DBG("chan %p, control 0x%2.2x", chan, control);
579 579
580 count = min_t(unsigned int, conn->mtu, hlen); 580 count = min_t(unsigned int, conn->mtu, hlen);
581 control |= L2CAP_CTRL_FRAME_TYPE; 581
582 control |= __set_sframe(chan);
582 583
583 if (test_and_clear_bit(CONN_SEND_FBIT, &chan->conn_state)) 584 if (test_and_clear_bit(CONN_SEND_FBIT, &chan->conn_state))
584 control |= L2CAP_CTRL_FINAL; 585 control |= L2CAP_CTRL_FINAL;
@@ -3707,7 +3708,7 @@ static int l2cap_ertm_data_rcv(struct sock *sk, struct sk_buff *skb)
3707 if (l2cap_check_fcs(chan, skb)) 3708 if (l2cap_check_fcs(chan, skb))
3708 goto drop; 3709 goto drop;
3709 3710
3710 if (__is_sar_start(chan, control) && __is_iframe(control)) 3711 if (__is_sar_start(chan, control) && !__is_sframe(chan, control))
3711 len -= 2; 3712 len -= 2;
3712 3713
3713 if (chan->fcs == L2CAP_FCS_CRC16) 3714 if (chan->fcs == L2CAP_FCS_CRC16)
@@ -3734,7 +3735,7 @@ static int l2cap_ertm_data_rcv(struct sock *sk, struct sk_buff *skb)
3734 goto drop; 3735 goto drop;
3735 } 3736 }
3736 3737
3737 if (__is_iframe(control)) { 3738 if (!__is_sframe(chan, control)) {
3738 if (len < 0) { 3739 if (len < 0) {
3739 l2cap_send_disconn_req(chan->conn, chan, ECONNRESET); 3740 l2cap_send_disconn_req(chan->conn, chan, ECONNRESET);
3740 goto drop; 3741 goto drop;
@@ -3817,7 +3818,7 @@ static inline int l2cap_data_channel(struct l2cap_conn *conn, u16 cid, struct sk
3817 if (chan->fcs == L2CAP_FCS_CRC16) 3818 if (chan->fcs == L2CAP_FCS_CRC16)
3818 len -= 2; 3819 len -= 2;
3819 3820
3820 if (len > chan->mps || len < 0 || __is_sframe(control)) 3821 if (len > chan->mps || len < 0 || __is_sframe(chan, control))
3821 goto drop; 3822 goto drop;
3822 3823
3823 tx_seq = __get_txseq(chan, control); 3824 tx_seq = __get_txseq(chan, control);