diff options
-rw-r--r-- | include/net/bluetooth/mgmt.h | 5 | ||||
-rw-r--r-- | net/bluetooth/mgmt.c | 23 |
2 files changed, 18 insertions, 10 deletions
diff --git a/include/net/bluetooth/mgmt.h b/include/net/bluetooth/mgmt.h index 52376a3295ca..5aee200e5e36 100644 --- a/include/net/bluetooth/mgmt.h +++ b/include/net/bluetooth/mgmt.h | |||
@@ -147,6 +147,11 @@ struct mgmt_cp_pin_code_reply { | |||
147 | __u8 pin_len; | 147 | __u8 pin_len; |
148 | __u8 pin_code[16]; | 148 | __u8 pin_code[16]; |
149 | } __packed; | 149 | } __packed; |
150 | struct mgmt_rp_pin_code_reply { | ||
151 | __le16 index; | ||
152 | bdaddr_t bdaddr; | ||
153 | uint8_t status; | ||
154 | } __packed; | ||
150 | 155 | ||
151 | #define MGMT_OP_PIN_CODE_NEG_REPLY 0x0012 | 156 | #define MGMT_OP_PIN_CODE_NEG_REPLY 0x0012 |
152 | struct mgmt_cp_pin_code_neg_reply { | 157 | struct mgmt_cp_pin_code_neg_reply { |
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c index d1d9b8c3a1b0..0d3d613baac2 100644 --- a/net/bluetooth/mgmt.c +++ b/net/bluetooth/mgmt.c | |||
@@ -1558,17 +1558,18 @@ int mgmt_pin_code_request(u16 index, bdaddr_t *bdaddr) | |||
1558 | int mgmt_pin_code_reply_complete(u16 index, bdaddr_t *bdaddr, u8 status) | 1558 | int mgmt_pin_code_reply_complete(u16 index, bdaddr_t *bdaddr, u8 status) |
1559 | { | 1559 | { |
1560 | struct pending_cmd *cmd; | 1560 | struct pending_cmd *cmd; |
1561 | struct mgmt_rp_pin_code_reply rp; | ||
1561 | int err; | 1562 | int err; |
1562 | 1563 | ||
1563 | cmd = mgmt_pending_find(MGMT_OP_PIN_CODE_REPLY, index); | 1564 | cmd = mgmt_pending_find(MGMT_OP_PIN_CODE_REPLY, index); |
1564 | if (!cmd) | 1565 | if (!cmd) |
1565 | return -ENOENT; | 1566 | return -ENOENT; |
1566 | 1567 | ||
1567 | if (status != 0) | 1568 | put_unaligned_le16(index, &rp.index); |
1568 | err = cmd_status(cmd->sk, MGMT_OP_PIN_CODE_REPLY, status); | 1569 | bacpy(&rp.bdaddr, bdaddr); |
1569 | else | 1570 | rp.status = status; |
1570 | err = cmd_complete(cmd->sk, MGMT_OP_PIN_CODE_REPLY, | 1571 | |
1571 | bdaddr, sizeof(*bdaddr)); | 1572 | err = cmd_complete(cmd->sk, MGMT_OP_PIN_CODE_REPLY, &rp, sizeof(rp)); |
1572 | 1573 | ||
1573 | list_del(&cmd->list); | 1574 | list_del(&cmd->list); |
1574 | mgmt_pending_free(cmd); | 1575 | mgmt_pending_free(cmd); |
@@ -1579,17 +1580,19 @@ int mgmt_pin_code_reply_complete(u16 index, bdaddr_t *bdaddr, u8 status) | |||
1579 | int mgmt_pin_code_neg_reply_complete(u16 index, bdaddr_t *bdaddr, u8 status) | 1580 | int mgmt_pin_code_neg_reply_complete(u16 index, bdaddr_t *bdaddr, u8 status) |
1580 | { | 1581 | { |
1581 | struct pending_cmd *cmd; | 1582 | struct pending_cmd *cmd; |
1583 | struct mgmt_rp_pin_code_reply rp; | ||
1582 | int err; | 1584 | int err; |
1583 | 1585 | ||
1584 | cmd = mgmt_pending_find(MGMT_OP_PIN_CODE_NEG_REPLY, index); | 1586 | cmd = mgmt_pending_find(MGMT_OP_PIN_CODE_NEG_REPLY, index); |
1585 | if (!cmd) | 1587 | if (!cmd) |
1586 | return -ENOENT; | 1588 | return -ENOENT; |
1587 | 1589 | ||
1588 | if (status != 0) | 1590 | put_unaligned_le16(index, &rp.index); |
1589 | err = cmd_status(cmd->sk, MGMT_OP_PIN_CODE_NEG_REPLY, status); | 1591 | bacpy(&rp.bdaddr, bdaddr); |
1590 | else | 1592 | rp.status = status; |
1591 | err = cmd_complete(cmd->sk, MGMT_OP_PIN_CODE_NEG_REPLY, | 1593 | |
1592 | bdaddr, sizeof(*bdaddr)); | 1594 | err = cmd_complete(cmd->sk, MGMT_OP_PIN_CODE_NEG_REPLY, |
1595 | &rp, sizeof(rp)); | ||
1593 | 1596 | ||
1594 | list_del(&cmd->list); | 1597 | list_del(&cmd->list); |
1595 | mgmt_pending_free(cmd); | 1598 | mgmt_pending_free(cmd); |