diff options
author | Gustavo F. Padovan <padovan@profusion.mobi> | 2010-05-01 15:15:35 -0400 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2010-05-10 03:28:45 -0400 |
commit | c69163e9ed5048407cc84f439cbfecc53f6f7131 (patch) | |
tree | d54406f55010dd89ae13e4462e67adceb9d3cd42 | |
parent | b9dbdbc1f4404cba2e64939c30c87d59c9796e4e (diff) |
Bluetooth: Move specific Basic Mode code to the right place
Inside "case L2CAP_MODE_BASIC:" we don't need to check for sk_type and
L2CAP mode. So only the length check is fine.
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Reviewed-by: João Paulo Rechi Vita <jprvita@profusion.mobi>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
-rw-r--r-- | net/bluetooth/l2cap.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/net/bluetooth/l2cap.c b/net/bluetooth/l2cap.c index 864c76f4a678..c9a848d3ef94 100644 --- a/net/bluetooth/l2cap.c +++ b/net/bluetooth/l2cap.c | |||
@@ -1611,11 +1611,6 @@ static int l2cap_sock_sendmsg(struct kiocb *iocb, struct socket *sock, struct ms | |||
1611 | if (msg->msg_flags & MSG_OOB) | 1611 | if (msg->msg_flags & MSG_OOB) |
1612 | return -EOPNOTSUPP; | 1612 | return -EOPNOTSUPP; |
1613 | 1613 | ||
1614 | /* Check outgoing MTU */ | ||
1615 | if (sk->sk_type == SOCK_SEQPACKET && pi->mode == L2CAP_MODE_BASIC && | ||
1616 | len > pi->omtu) | ||
1617 | return -EINVAL; | ||
1618 | |||
1619 | lock_sock(sk); | 1614 | lock_sock(sk); |
1620 | 1615 | ||
1621 | if (sk->sk_state != BT_CONNECTED) { | 1616 | if (sk->sk_state != BT_CONNECTED) { |
@@ -1635,6 +1630,12 @@ static int l2cap_sock_sendmsg(struct kiocb *iocb, struct socket *sock, struct ms | |||
1635 | 1630 | ||
1636 | switch (pi->mode) { | 1631 | switch (pi->mode) { |
1637 | case L2CAP_MODE_BASIC: | 1632 | case L2CAP_MODE_BASIC: |
1633 | /* Check outgoing MTU */ | ||
1634 | if (len > pi->omtu) { | ||
1635 | err = -EINVAL; | ||
1636 | goto done; | ||
1637 | } | ||
1638 | |||
1638 | /* Create a basic PDU */ | 1639 | /* Create a basic PDU */ |
1639 | skb = l2cap_create_basic_pdu(sk, msg, len); | 1640 | skb = l2cap_create_basic_pdu(sk, msg, len); |
1640 | if (IS_ERR(skb)) { | 1641 | if (IS_ERR(skb)) { |