Bluetooth: Fix l2cap_sock_setsockopt() with optname BT_RCVMTU
authorAmadeusz Sławiński <amadeusz.slawinski@tieto.com>
Thu, 14 Jul 2016 08:50:23 +0000 (10:50 +0200)
committerSasha Levin <alexander.levin@verizon.com>
Sat, 20 Aug 2016 03:07:58 +0000 (23:07 -0400)
[ Upstream commit 23bc6ab0a0912146fd674a0becc758c3162baabc ]

When we retrieve imtu value from userspace we should use 16 bit pointer
cast instead of 32 as it's defined that way in headers. Fixes setsockopt
calls on big-endian platforms.

Signed-off-by: Amadeusz Sławiński <amadeusz.slawinski@tieto.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Cc: stable@vger.kernel.org
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
net/bluetooth/l2cap_sock.c

index a7278f05eafbbda65da7c991820474a95e4e1a3c..289c96d3e47dc17372a477bb0b3dd6316a0f1e75 100644 (file)
@@ -927,7 +927,7 @@ static int l2cap_sock_setsockopt(struct socket *sock, int level, int optname,
                        break;
                }
 
-               if (get_user(opt, (u32 __user *) optval)) {
+               if (get_user(opt, (u16 __user *) optval)) {
                        err = -EFAULT;
                        break;
                }