Skip to content

Commit

Permalink
Bluetooth: Return EOPNOTSUPP for HCISETRAW ioctl command
Browse files Browse the repository at this point in the history
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.

Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
  • Loading branch information
Marcel Holtmann authored and Gustavo Padovan committed Apr 24, 2014
1 parent b16c660 commit db59668
Showing 1 changed file with 1 addition and 10 deletions.
11 changes: 1 addition & 10 deletions net/bluetooth/hci_sock.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit db59668

Please sign in to comment.