Bluetooth: hidp: Fix regression with older userspace and flags validation
authorMarcel Holtmann <marcel@holtmann.org>
Fri, 17 Apr 2015 20:34:18 +0000 (22:34 +0200)
committerLinus Torvalds <torvalds@linux-foundation.org>
Sat, 18 Apr 2015 15:01:08 +0000 (11:01 -0400)
While it is not used by newer userspace anymore, the older userspace was
utilizing HIDP_VIRTUAL_CABLE_UNPLUG and HIDP_BOOT_PROTOCOL_MODE flags
when adding a new HIDP connection.

The flags validation is important, but we can not break older userspace
and with that allow providing these flags even if newer userspace does
not use them anymore.

Reported-and-tested-by: Jörg Otte <jrg.otte@gmail.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
net/bluetooth/hidp/core.c

index a05b9dbf14c991dd1a90de4f23877bc02b78e1b5..9070dfd6b4adcd247c482589c27d5d4519302b7c 100644 (file)
@@ -1313,7 +1313,8 @@ int hidp_connection_add(struct hidp_connadd_req *req,
                        struct socket *ctrl_sock,
                        struct socket *intr_sock)
 {
-       u32 valid_flags = 0;
+       u32 valid_flags = BIT(HIDP_VIRTUAL_CABLE_UNPLUG) |
+                         BIT(HIDP_BOOT_PROTOCOL_MODE);
        struct hidp_session *session;
        struct l2cap_conn *conn;
        struct l2cap_chan *chan;