OSDN Git Service

media: dmxdev: fix error code for invalid ioctls
authorMauro Carvalho Chehab <mchehab@s-opensource.com>
Sun, 11 Feb 2018 10:44:21 +0000 (05:44 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 25 May 2018 14:13:12 +0000 (16:13 +0200)
[ Upstream commit a145f64c6107d3aa5a7cec9f8977d04ac2a896c9 ]

Returning -EINVAL when an ioctl is not implemented is a very
bad idea, as it is hard to distinguish from other error
contitions that an ioctl could lead. Replace it by its
right error code: -ENOTTY.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/media/dvb-core/dmxdev.c

index 7b67e1d..0418b5a 100644 (file)
@@ -1071,7 +1071,7 @@ static int dvb_demux_do_ioctl(struct file *file,
                break;
 
        default:
-               ret = -EINVAL;
+               ret = -ENOTTY;
                break;
        }
        mutex_unlock(&dmxdev->mutex);