linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: johan.hedberg@gmail.com
To: linux-bluetooth@vger.kernel.org
Subject: [PATCH v5 3/8] Bluetooth: Fix L2CAP error return used for failed channel lookups
Date: Mon, 16 Sep 2013 13:05:14 +0300	[thread overview]
Message-ID: <1379325919-19003-4-git-send-email-johan.hedberg@gmail.com> (raw)
In-Reply-To: <1379325919-19003-1-git-send-email-johan.hedberg@gmail.com>

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

The EFAULT error should only be used for memory address related errors
and ENOENT might be needed for other purposes than invalid CID errors.
This patch fixes the l2cap_config_req, l2cap_connect_create_rsp and
l2cap_create_channel_req handlers to use the unique EBADSLT error to
indicate failed lookups on a given CID.

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

diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c
index 0b8a270..eb60cf7 100644
--- a/net/bluetooth/l2cap_core.c
+++ b/net/bluetooth/l2cap_core.c
@@ -3884,13 +3884,13 @@ static int l2cap_connect_create_rsp(struct l2cap_conn *conn,
 	if (scid) {
 		chan = __l2cap_get_chan_by_scid(conn, scid);
 		if (!chan) {
-			err = -EFAULT;
+			err = -EBADSLT;
 			goto unlock;
 		}
 	} else {
 		chan = __l2cap_get_chan_by_ident(conn, cmd->ident);
 		if (!chan) {
-			err = -EFAULT;
+			err = -EBADSLT;
 			goto unlock;
 		}
 	}
@@ -3978,7 +3978,7 @@ static inline int l2cap_config_req(struct l2cap_conn *conn,
 
 	chan = l2cap_get_chan_by_scid(conn, dcid);
 	if (!chan)
-		return -ENOENT;
+		return -EBADSLT;
 
 	if (chan->state != BT_CONFIG && chan->state != BT_CONNECT2) {
 		struct l2cap_cmd_rej_cid rej;
@@ -4438,7 +4438,7 @@ static int l2cap_create_channel_req(struct l2cap_conn *conn,
 		hs_hcon = hci_conn_hash_lookup_ba(hdev, AMP_LINK, conn->dst);
 		if (!hs_hcon) {
 			hci_dev_put(hdev);
-			return -EFAULT;
+			return -EBADSLT;
 		}
 
 		BT_DBG("mgr %p bredr_chan %p hs_hcon %p", mgr, chan, hs_hcon);
-- 
1.8.4.rc3


  parent reply	other threads:[~2013-09-16 10:05 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-16 10:05 [PATCH v5 0/8] Bluetooth: Various L2CAP fixes johan.hedberg
2013-09-16 10:05 ` [PATCH v5 1/8] Bluetooth: Remove unused event mask struct johan.hedberg
2013-09-16 10:05 ` [PATCH v5 2/8] Bluetooth: Fix double error response for l2cap_create_chan_req johan.hedberg
2013-09-16 10:05 ` johan.hedberg [this message]
2013-09-16 14:12   ` [PATCH v5 3/8] Bluetooth: Fix L2CAP error return used for failed channel lookups Marcel Holtmann
2013-09-16 10:05 ` [PATCH v5 4/8] Bluetooth: Fix L2CAP Disconnect response for unknown CID johan.hedberg
2013-09-16 14:10   ` Marcel Holtmann
2013-09-16 10:05 ` [PATCH v5 5/8] Bluetooth: Fix L2CAP command reject reason johan.hedberg
2013-09-16 14:11   ` Marcel Holtmann
2013-09-16 10:05 ` [PATCH v5 6/8] Bluetooth: Fix sending responses to identified L2CAP response packets johan.hedberg
2013-09-16 10:05 ` [PATCH v5 7/8] Bluetooth: Fix responding to invalid L2CAP signaling commands johan.hedberg
2013-09-16 10:05 ` [PATCH v5 8/8] Bluetooth: Fix waiting for clearing of BT_SK_SUSPEND flag johan.hedberg
2013-09-16 14:13   ` Marcel Holtmann
2013-09-18 22:04   ` Gustavo Padovan

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=1379325919-19003-4-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).