Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 314474
b: refs/heads/master
c: 682877c
h: refs/heads/master
v: v3
  • Loading branch information
Andre Guedes authored and Johan Hedberg committed Jun 5, 2012
1 parent 69e0146 commit 31f41fa
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 6fcb06a28d150095f042c477fbe20a9767d9a951
refs/heads/master: 682877c31fc1b6510b694b6b8e78d8dde53a47cc
21 changes: 21 additions & 0 deletions trunk/net/bluetooth/l2cap_sock.c
Original file line number Diff line number Diff line change
Expand Up @@ -445,6 +445,22 @@ static int l2cap_sock_getsockopt(struct socket *sock, int level, int optname, ch
return err;
}

static bool l2cap_valid_mtu(struct l2cap_chan *chan, u16 mtu)
{
switch (chan->scid) {
case L2CAP_CID_LE_DATA:
if (mtu < L2CAP_LE_DEFAULT_MTU)
return false;
break;

default:
if (mtu < L2CAP_DEFAULT_MIN_MTU)
return false;
}

return true;
}

static int l2cap_sock_setsockopt_old(struct socket *sock, int optname, char __user *optval, unsigned int optlen)
{
struct sock *sk = sock->sk;
Expand Down Expand Up @@ -483,6 +499,11 @@ static int l2cap_sock_setsockopt_old(struct socket *sock, int optname, char __us
break;
}

if (!l2cap_valid_mtu(chan, opts.imtu)) {
err = -EINVAL;
break;
}

chan->mode = opts.mode;
switch (chan->mode) {
case L2CAP_MODE_BASIC:
Expand Down

0 comments on commit 31f41fa

Please sign in to comment.