Skip to contentSkip to conversation

Bluetooth: Return EOPNOTSUPP for HCISETRAW ioctl command

PATCH Applied Marcel Holtmann 2 participants 2 messages Apr 17, 2014 – Apr 22, 2014

Subsystems (2)
lore
Share & tools
lore

Marcel Holtmann

author maintainer
#0 lore raw

PATCH 1/1 Bluetooth: Return EOPNOTSUPP for HCISETRAW ioctl command

The HCISETRAW ioctl command is not really useful. To utilize raw and direct access to the HCI controller, the HCI User Channel feature has been introduced. Return EOPNOTSUPP to indicate missing support for this command.

For legacy reasons hcidump used to use HCISETRAW for permission check to return proper error codes to users. To keep backwards compability return EPERM in case the caller does not have CAP_NET_ADMIN capability.

---
 net/bluetooth/hci_sock.c | 11 +----------
 1 file changed, 1 insertion(+), 10 deletions(-)
net/bluetooth/hci_sock.c +1 -10
index b9a418e578e0..f608bffdb8b9 100644
@@ -524,16 +524,7 @@ static int hci_sock_bound_ioctl(struct sock *sk, unsigned int cmd,
 	case HCISETRAW:
 		if (!capable(CAP_NET_ADMIN))
 			return -EPERM;
-
-		if (test_bit(HCI_QUIRK_RAW_DEVICE, &hdev->quirks))
-			return -EPERM;
-
-		if (arg)
-			set_bit(HCI_RAW, &hdev->flags);
-		else
-			clear_bit(HCI_RAW, &hdev->flags);
-
-		return 0;
+		return -EOPNOTSUPP;
 
 	case HCIGETCONNINFO:
 		return hci_get_conn_info(hdev, (void __user *) arg);
Signature · 1 line
1.9.0
#1 lore raw

Hi Marcel,

Quoted 5 lines · Marcel Holtmann

The HCISETRAW ioctl command is not really useful. To utilize raw and direct access to the HCI controller, the HCI User Channel feature has been introduced. Return EOPNOTSUPP to indicate missing support for this command.

Quoted 8 lines

For legacy reasons hcidump used to use HCISETRAW for permission check to return proper error codes to users. To keep backwards compability return EPERM in case the caller does not have CAP_NET_ADMIN capability.

---
 net/bluetooth/hci_sock.c | 11 +----------
 1 file changed, 1 insertion(+), 10 deletions(-)

Applied to bluetooth-next. Thanks.

Johan