Skip to content

Commit f52c8fb

Browse files
t-8chjmberg-intel
authored andcommitted
rfkill: return ENOTTY on invalid ioctl
For unknown ioctls the correct error is ENOTTY "Inappropriate ioctl for device". ENOSYS as returned before should only be used to indicate that a syscall is not available at all. Signed-off-by: Thomas Weißschuh <linux@weissschuh.net> Reviewed-by: Przemek Kitszel <przemyslaw.kitszel@intel.com> Link: https://lore.kernel.org/r/20231101-rfkill-ioctl-enosys-v1-1-5bf374fabffe@weissschuh.net [in theory this breaks userspace API, but it was discussed and researched, and nothing found relying on the current behaviour] Signed-off-by: Johannes Berg <johannes.berg@intel.com>
1 parent ea5f490 commit f52c8fb

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

net/rfkill/core.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1351,11 +1351,11 @@ static long rfkill_fop_ioctl(struct file *file, unsigned int cmd,
13511351
unsigned long arg)
13521352
{
13531353
struct rfkill_data *data = file->private_data;
1354-
int ret = -ENOSYS;
1354+
int ret = -ENOTTY;
13551355
u32 size;
13561356

13571357
if (_IOC_TYPE(cmd) != RFKILL_IOC_MAGIC)
1358-
return -ENOSYS;
1358+
return -ENOTTY;
13591359

13601360
mutex_lock(&data->mtx);
13611361
switch (_IOC_NR(cmd)) {

0 commit comments

Comments
 (0)