diff --git a/include/net/bluetooth/mgmt.h b/include/net/bluetooth/mgmt.h index bd6995d69931df0aa412a9f1ce0ba5e803cc85a3..2e501820f728b049e3aaa62bebb41337550361b9 100644 --- a/include/net/bluetooth/mgmt.h +++ b/include/net/bluetooth/mgmt.h @@ -232,6 +232,9 @@ struct mgmt_cp_remove_remote_oob_data { } __packed; #define MGMT_OP_START_DISCOVERY 0x001B +struct mgmt_cp_start_discovery { + __u8 type; +} __packed; #define MGMT_OP_STOP_DISCOVERY 0x001C diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c index e4a353cfa97d3519424489ded76743bb47509bb5..1ae14c91bb0c1840867435e0197a636cc6987fc8 100644 --- a/net/bluetooth/mgmt.c +++ b/net/bluetooth/mgmt.c @@ -1779,14 +1779,20 @@ static int remove_remote_oob_data(struct sock *sk, u16 index, return err; } -static int start_discovery(struct sock *sk, u16 index) +static int start_discovery(struct sock *sk, u16 index, + unsigned char *data, u16 len) { + struct mgmt_cp_start_discovery *cp = (void *) data; struct pending_cmd *cmd; struct hci_dev *hdev; int err; BT_DBG("hci%u", index); + if (len != sizeof(*cp)) + return cmd_status(sk, index, MGMT_OP_START_DISCOVERY, + MGMT_STATUS_INVALID_PARAMS); + hdev = hci_dev_get(index); if (!hdev) return cmd_status(sk, index, MGMT_OP_START_DISCOVERY, @@ -2083,7 +2089,7 @@ int mgmt_control(struct sock *sk, struct msghdr *msg, size_t msglen) len); break; case MGMT_OP_START_DISCOVERY: - err = start_discovery(sk, index); + err = start_discovery(sk, index, buf + sizeof(*hdr), len); break; case MGMT_OP_STOP_DISCOVERY: err = stop_discovery(sk, index);