* [PATCH] Bluetooth: Disabling discoverable with timeout is invalid
@ 2012-02-22 17:06 Marcel Holtmann
2012-02-22 17:31 ` Johan Hedberg
0 siblings, 1 reply; 2+ messages in thread
From: Marcel Holtmann @ 2012-02-22 17:06 UTC (permalink / raw)
To: linux-bluetooth
Add one extra sanity check to ensure that the supplied timeout value is
actually valid in this context.
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
---
net/bluetooth/mgmt.c | 7 +++++--
1 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index d756644..6df4af6 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -850,13 +850,16 @@ static int set_discoverable(struct sock *sk, u16 index, void *data, u16 len)
return cmd_status(sk, index, MGMT_OP_SET_DISCOVERABLE,
MGMT_STATUS_INVALID_PARAMS);
+ timeout = get_unaligned_le16(&cp->timeout);
+ if (!cp->val && timeout > 0)
+ return cmd_status(sk, index, MGMT_OP_SET_DISCOVERABLE,
+ MGMT_STATUS_INVALID_PARAMS);
+
hdev = hci_dev_get(index);
if (!hdev)
return cmd_status(sk, index, MGMT_OP_SET_DISCOVERABLE,
MGMT_STATUS_INVALID_PARAMS);
- timeout = get_unaligned_le16(&cp->timeout);
-
hci_dev_lock(hdev);
if (!hdev_is_powered(hdev) && timeout > 0) {
--
1.7.7.6
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] Bluetooth: Disabling discoverable with timeout is invalid
2012-02-22 17:06 [PATCH] Bluetooth: Disabling discoverable with timeout is invalid Marcel Holtmann
@ 2012-02-22 17:31 ` Johan Hedberg
0 siblings, 0 replies; 2+ messages in thread
From: Johan Hedberg @ 2012-02-22 17:31 UTC (permalink / raw)
To: Marcel Holtmann; +Cc: linux-bluetooth
Hi Marcel,
On Wed, Feb 22, 2012, Marcel Holtmann wrote:
> Add one extra sanity check to ensure that the supplied timeout value is
> actually valid in this context.
>
> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
> ---
> net/bluetooth/mgmt.c | 7 +++++--
> 1 files changed, 5 insertions(+), 2 deletions(-)
Applied. Thanks.
Johan
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-02-22 17:31 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-02-22 17:06 [PATCH] Bluetooth: Disabling discoverable with timeout is invalid Marcel Holtmann
2012-02-22 17:31 ` Johan Hedberg
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox