lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20220428130435.896-1-tangmeng@uniontech.com>
Date:   Thu, 28 Apr 2022 21:04:35 +0800
From:   Meng Tang <tangmeng@...ontech.com>
To:     marcel@...tmann.org, johan.hedberg@...il.com, luiz.dentz@...il.com,
        davem@...emloft.net, kuba@...nel.org, pabeni@...hat.com
Cc:     linux-bluetooth@...r.kernel.org, netdev@...r.kernel.org,
        linux-kernel@...r.kernel.org, Meng Tang <tangmeng@...ontech.com>
Subject: [PATCH] Bluetooth: Add bluetooth error information for error codes

Bluetooth error codes to Unix errno mapping is not completed. For
example, the following Bluetooth error codes are directly classified
as ENOSYS.

  /* Possible error codes */
  #define HCI_SCO_INTERVAL_REJECTED     0x1C
  #define HCI_SCO_AIR_MODE_REJECTED     0x1D
  #define HCI_UNSPECIFIED_ERROR         0x1F
  #define HCI_ROLE_CHANGE_NOT_ALLOWED   0x21
  #define HCI_LMP_RESPONSE_TIMEOUT      0x22
  #define HCI_UNIT_KEY_USED             0x26
  #define HCI_INSTANT_PASSED            0x28

As a result, when these error codes occur in Bluetooth, ENOSYS is
always returned, and users cannot know the specific error codes of
Bluetooth, thus affecting the positioning of Bluetooth problems.

This will make it difficult to locate and analyze Bluetooth issues.
Therefore, I added information for bluetooth error codes that are
not currently mapped to help users get bluetooth error codes.

Signed-off-by: Meng Tang <tangmeng@...ontech.com>
---
 net/bluetooth/lib.c | 29 +++++++++++++++++++++++++++++
 1 file changed, 29 insertions(+)

diff --git a/net/bluetooth/lib.c b/net/bluetooth/lib.c
index 5326f41a58b7..eaf952de0ef9 100644
--- a/net/bluetooth/lib.c
+++ b/net/bluetooth/lib.c
@@ -122,6 +122,14 @@ int bt_to_errno(__u16 code)
 	case 0x1b:
 		return ECONNREFUSED;
 
+	case 0x1c:
+		printk(KERN_ERR "Bluetooth: errno(0x%02x), SCO Interval Rejected", code);
+		return ENOSYS;
+
+	case 0x1d:
+		printk(KERN_ERR "Bluetooth: errno(0x%02x), SCO Air Mode Rejected", code);
+		return ENOSYS;
+
 	case 0x19:
 	case 0x1e:
 	case 0x23:
@@ -129,7 +137,28 @@ int bt_to_errno(__u16 code)
 	case 0x25:
 		return EPROTO;
 
+	case 0x1f:
+		printk(KERN_ERR "Bluetooth: errno(0x%02x), Unspecified Error", code);
+		return ENOSYS;
+
+	case 0x21:
+		printk(KERN_ERR "Bluetooth: errno(0x%02x), Role Change Not Allowed", code);
+		return ENOSYS;
+
+	case 0x22:
+		printk(KERN_ERR "Bluetooth: errno(0x%02x), LMP Response Timeout", code);
+		return ENOSYS;
+
+	case 0x26:
+		printk(KERN_ERR "Bluetooth: errno(0x%02x), Unit Key Used", code);
+		return ENOSYS;
+
+	case 0x28:
+		printk(KERN_ERR "Bluetooth: errno(0x%02x), Instant Passed", code);
+		return ENOSYS;
+
 	default:
+		printk(KERN_ERR "Bluetooth: errno(0x%02x), Error code unknown", code);
 		return ENOSYS;
 	}
 }
-- 
2.20.1



Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ