linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Johan Hedberg <johan.hedberg@gmail.com>
To: linux-bluetooth@vger.kernel.org
Subject: [PATCH 08/10] Bluetooth: Fix checking for valid disconnect parameters in unpair_device
Date: Fri, 18 Jan 2013 15:25:56 +0200	[thread overview]
Message-ID: <1358515558-17861-9-git-send-email-johan.hedberg@gmail.com> (raw)
In-Reply-To: <1358515558-17861-1-git-send-email-johan.hedberg@gmail.com>

From: Johan Hedberg <johan.hedberg@intel.com>

The valid values for the Disconnect parameter in the Unpair Device
command are 0x00 and 0x01. If any other value is encountered the command
should fail with the appropriate invalid params response.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
---
 net/bluetooth/mgmt.c |    5 +++++
 1 file changed, 5 insertions(+)

diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index 3de4bc2..8ec3c4f 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -1591,6 +1591,11 @@ static int unpair_device(struct sock *sk, struct hci_dev *hdev, void *data,
 				    MGMT_STATUS_INVALID_PARAMS,
 				    &rp, sizeof(rp));
 
+	if (cp->disconnect != 0x00 && cp->disconnect != 0x01)
+		return cmd_complete(sk, hdev->id, MGMT_OP_UNPAIR_DEVICE,
+				    MGMT_STATUS_INVALID_PARAMS,
+				    &rp, sizeof(rp));
+
 	hci_dev_lock(hdev);
 
 	if (!hdev_is_powered(hdev)) {
-- 
1.7.10.4


  parent reply	other threads:[~2013-01-18 13:25 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-18 13:25 [PATCH 00/10] Bluetooth: Fix more mgmt parameter checks Johan Hedberg
2013-01-18 13:25 ` [PATCH 01/10] Bluetooth: Fix checking for correct mgmt_load_link_keys parameters Johan Hedberg
2013-01-18 16:55   ` Marcel Holtmann
2013-01-18 13:25 ` [PATCH 02/10] Bluetooth: Fix returning proper mgmt status for Load LTKs Johan Hedberg
2013-01-18 16:55   ` Marcel Holtmann
2013-01-18 13:25 ` [PATCH 03/10] Bluetooth: Fix checking for proper key->master value in " Johan Hedberg
2013-01-18 13:25 ` [PATCH 04/10] Bluetooth: Refactor valid LTK data testing into its own function Johan Hedberg
2013-01-18 13:25 ` [PATCH 05/10] Bluetooth: Check for valid key->authenticated value for LTKs Johan Hedberg
2013-01-18 13:25 ` [PATCH 06/10] Bluetooth: Add helper functions for testing bdaddr types Johan Hedberg
2013-01-18 13:25 ` [PATCH 07/10] Bluetooth: Fix checking for valid address type values in mgmt commands Johan Hedberg
2013-01-18 16:53   ` Marcel Holtmann
2013-01-18 13:25 ` Johan Hedberg [this message]
2013-01-18 16:54   ` [PATCH 08/10] Bluetooth: Fix checking for valid disconnect parameters in unpair_device Marcel Holtmann
2013-01-18 13:25 ` [PATCH 09/10] Bluetooth: Fix returning proper cmd_complete for mgmt_disconnect Johan Hedberg
2013-01-18 13:25 ` [PATCH 10/10] Bluetooth: Fix returning proper cmd_complete for mgmt_block/unblock Johan Hedberg

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1358515558-17861-9-git-send-email-johan.hedberg@gmail.com \
    --to=johan.hedberg@gmail.com \
    --cc=linux-bluetooth@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).