Bluetooth: Check the tx_window size on setsockopt
authorGustavo F. Padovan <padovan@profusion.mobi>
Mon, 7 Jun 2010 22:21:30 +0000 (19:21 -0300)
committerMarcel Holtmann <marcel@holtmann.org>
Wed, 21 Jul 2010 17:39:07 +0000 (10:39 -0700)
We have to check if the proposed tx_window value is not greater that
maximum value supported.

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>
net/bluetooth/l2cap.c

index f0441b0b033543caed0eb67e0a41804e4889ab06..6094870d5d2a20df5e01f8ff36d153c36b80eb80 100644 (file)
@@ -1912,6 +1912,11 @@ static int l2cap_sock_setsockopt_old(struct socket *sock, int optname, char __us
                        break;
                }
 
+               if (opts.txwin_size > L2CAP_DEFAULT_TX_WINDOW) {
+                       err = -EINVAL;
+                       break;
+               }
+
                l2cap_pi(sk)->mode = opts.mode;
                switch (l2cap_pi(sk)->mode) {
                case L2CAP_MODE_BASIC: