[WATCHDOG] use ENOTTY instead of ENOIOCTLCMD in ioctl()
Return ENOTTY instead of ENOIOCTLCMD in user-visible ioctl() results The watchdog drivers used to return ENOIOCTLCMD for bad ioctl() commands. ENOIOCTLCMD should not be visible by the user, so use ENOTTY instead. Signed-off-by: Samuel Tardieu <sam@rfc1149.net> Signed-off-by: Wim Van Sebroeck <wim@iguana.be> Acked-by: Alan Cox <alan@redhat.com> Signed-off-by: Andrew Morton <akpm@osdl.org>
This commit is contained in:
parent
25ff3780d4
commit
795b89d207
@ -183,7 +183,7 @@ static int acq_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
|
|||||||
}
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return -ENOIOCTLCMD;
|
return -ENOTTY;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -176,7 +176,7 @@ advwdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
|
|||||||
}
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return -ENOIOCTLCMD;
|
return -ENOTTY;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -236,7 +236,7 @@ static int ali_ioctl(struct inode *inode, struct file *file,
|
|||||||
return put_user(timeout, p);
|
return put_user(timeout, p);
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return -ENOIOCTLCMD;
|
return -ENOTTY;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -277,7 +277,7 @@ static int fop_ioctl(struct inode *inode, struct file *file, unsigned int cmd, u
|
|||||||
case WDIOC_GETTIMEOUT:
|
case WDIOC_GETTIMEOUT:
|
||||||
return put_user(timeout, p);
|
return put_user(timeout, p);
|
||||||
default:
|
default:
|
||||||
return -ENOIOCTLCMD;
|
return -ENOTTY;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -168,7 +168,7 @@ static int at91_wdt_ioctl(struct inode *inode, struct file *file,
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return -ENOIOCTLCMD;
|
return -ENOTTY;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -125,7 +125,7 @@ static int booke_wdt_ioctl (struct inode *inode, struct file *file,
|
|||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
return 0;
|
return 0;
|
||||||
default:
|
default:
|
||||||
return -ENOIOCTLCMD;
|
return -ENOTTY;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -183,7 +183,7 @@ static int cpu5wdt_ioctl(struct inode *inode, struct file *file, unsigned int cm
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return -ENOIOCTLCMD;
|
return -ENOTTY;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -144,7 +144,7 @@ static int
|
|||||||
ep93xx_wdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
|
ep93xx_wdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
|
||||||
unsigned long arg)
|
unsigned long arg)
|
||||||
{
|
{
|
||||||
int ret = -ENOIOCTLCMD;
|
int ret = -ENOTTY;
|
||||||
|
|
||||||
switch (cmd) {
|
switch (cmd) {
|
||||||
case WDIOC_GETSUPPORT:
|
case WDIOC_GETSUPPORT:
|
||||||
|
@ -240,7 +240,7 @@ static int eurwdt_ioctl(struct inode *inode, struct file *file,
|
|||||||
|
|
||||||
switch(cmd) {
|
switch(cmd) {
|
||||||
default:
|
default:
|
||||||
return -ENOIOCTLCMD;
|
return -ENOTTY;
|
||||||
|
|
||||||
case WDIOC_GETSUPPORT:
|
case WDIOC_GETSUPPORT:
|
||||||
return copy_to_user(argp, &ident, sizeof(ident)) ? -EFAULT : 0;
|
return copy_to_user(argp, &ident, sizeof(ident)) ? -EFAULT : 0;
|
||||||
|
@ -315,7 +315,7 @@ static int esb_ioctl (struct inode *inode, struct file *file,
|
|||||||
return put_user(heartbeat, p);
|
return put_user(heartbeat, p);
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return -ENOIOCTLCMD;
|
return -ENOTTY;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -356,7 +356,7 @@ static int i8xx_tco_ioctl (struct inode *inode, struct file *file,
|
|||||||
}
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return -ENOIOCTLCMD;
|
return -ENOTTY;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -199,7 +199,7 @@ ibwdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return -ENOIOCTLCMD;
|
return -ENOTTY;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -295,7 +295,7 @@ static int asr_ioctl(struct inode *inode, struct file *file,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return -ENOIOCTLCMD;
|
return -ENOTTY;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int asr_open(struct inode *inode, struct file *file)
|
static int asr_open(struct inode *inode, struct file *file)
|
||||||
|
@ -112,7 +112,7 @@ static int indydog_ioctl(struct inode *inode, struct file *file,
|
|||||||
|
|
||||||
switch (cmd) {
|
switch (cmd) {
|
||||||
default:
|
default:
|
||||||
return -ENOIOCTLCMD;
|
return -ENOTTY;
|
||||||
case WDIOC_GETSUPPORT:
|
case WDIOC_GETSUPPORT:
|
||||||
if (copy_to_user((struct watchdog_info *)arg,
|
if (copy_to_user((struct watchdog_info *)arg,
|
||||||
&ident, sizeof(ident)))
|
&ident, sizeof(ident)))
|
||||||
|
@ -107,7 +107,7 @@ static int
|
|||||||
ixp2000_wdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
|
ixp2000_wdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
|
||||||
unsigned long arg)
|
unsigned long arg)
|
||||||
{
|
{
|
||||||
int ret = -ENOIOCTLCMD;
|
int ret = -ENOTTY;
|
||||||
int time;
|
int time;
|
||||||
|
|
||||||
switch (cmd) {
|
switch (cmd) {
|
||||||
|
@ -102,7 +102,7 @@ static int
|
|||||||
ixp4xx_wdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
|
ixp4xx_wdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
|
||||||
unsigned long arg)
|
unsigned long arg)
|
||||||
{
|
{
|
||||||
int ret = -ENOIOCTLCMD;
|
int ret = -ENOTTY;
|
||||||
int time;
|
int time;
|
||||||
|
|
||||||
switch (cmd) {
|
switch (cmd) {
|
||||||
|
@ -329,7 +329,7 @@ static int zf_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return -ENOIOCTLCMD;
|
return -ENOTTY;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -185,7 +185,7 @@ static int mixcomwd_ioctl(struct inode *inode, struct file *file,
|
|||||||
mixcomwd_ping();
|
mixcomwd_ping();
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return -ENOIOCTLCMD;
|
return -ENOTTY;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -125,7 +125,7 @@ static int mpc83xx_wdt_ioctl(struct inode *inode, struct file *file,
|
|||||||
case WDIOC_GETTIMEOUT:
|
case WDIOC_GETTIMEOUT:
|
||||||
return put_user(timeout_sec, p);
|
return put_user(timeout_sec, p);
|
||||||
default:
|
default:
|
||||||
return -ENOIOCTLCMD;
|
return -ENOTTY;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -126,7 +126,7 @@ static int mpc8xx_wdt_ioctl(struct inode *inode, struct file *file,
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return -ENOIOCTLCMD;
|
return -ENOTTY;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -221,7 +221,7 @@ static int mpcore_wdt_ioctl(struct inode *inode, struct file *file,
|
|||||||
} uarg;
|
} uarg;
|
||||||
|
|
||||||
if (_IOC_DIR(cmd) && _IOC_SIZE(cmd) > sizeof(uarg))
|
if (_IOC_DIR(cmd) && _IOC_SIZE(cmd) > sizeof(uarg))
|
||||||
return -ENOIOCTLCMD;
|
return -ENOTTY;
|
||||||
|
|
||||||
if (_IOC_DIR(cmd) & _IOC_WRITE) {
|
if (_IOC_DIR(cmd) & _IOC_WRITE) {
|
||||||
ret = copy_from_user(&uarg, (void __user *)arg, _IOC_SIZE(cmd));
|
ret = copy_from_user(&uarg, (void __user *)arg, _IOC_SIZE(cmd));
|
||||||
@ -271,7 +271,7 @@ static int mpcore_wdt_ioctl(struct inode *inode, struct file *file,
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return -ENOIOCTLCMD;
|
return -ENOTTY;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ret == 0 && _IOC_DIR(cmd) & _IOC_READ) {
|
if (ret == 0 && _IOC_DIR(cmd) & _IOC_READ) {
|
||||||
|
@ -160,7 +160,7 @@ static int mv64x60_wdt_ioctl(struct inode *inode, struct file *file,
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return -ENOIOCTLCMD;
|
return -ENOTTY;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -572,7 +572,7 @@ static int pcwd_ioctl(struct inode *inode, struct file *file,
|
|||||||
|
|
||||||
switch(cmd) {
|
switch(cmd) {
|
||||||
default:
|
default:
|
||||||
return -ENOIOCTLCMD;
|
return -ENOTTY;
|
||||||
|
|
||||||
case WDIOC_GETSUPPORT:
|
case WDIOC_GETSUPPORT:
|
||||||
if(copy_to_user(argp, &ident, sizeof(ident)))
|
if(copy_to_user(argp, &ident, sizeof(ident)))
|
||||||
|
@ -541,7 +541,7 @@ static int pcipcwd_ioctl(struct inode *inode, struct file *file,
|
|||||||
}
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return -ENOIOCTLCMD;
|
return -ENOTTY;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -445,7 +445,7 @@ static int usb_pcwd_ioctl(struct inode *inode, struct file *file,
|
|||||||
}
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return -ENOIOCTLCMD;
|
return -ENOTTY;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -288,7 +288,7 @@ static int s3c2410wdt_ioctl(struct inode *inode, struct file *file,
|
|||||||
|
|
||||||
switch (cmd) {
|
switch (cmd) {
|
||||||
default:
|
default:
|
||||||
return -ENOIOCTLCMD;
|
return -ENOTTY;
|
||||||
|
|
||||||
case WDIOC_GETSUPPORT:
|
case WDIOC_GETSUPPORT:
|
||||||
return copy_to_user(argp, &s3c2410_wdt_ident,
|
return copy_to_user(argp, &s3c2410_wdt_ident,
|
||||||
|
@ -90,7 +90,7 @@ static struct watchdog_info ident = {
|
|||||||
static int sa1100dog_ioctl(struct inode *inode, struct file *file,
|
static int sa1100dog_ioctl(struct inode *inode, struct file *file,
|
||||||
unsigned int cmd, unsigned long arg)
|
unsigned int cmd, unsigned long arg)
|
||||||
{
|
{
|
||||||
int ret = -ENOIOCTLCMD;
|
int ret = -ENOTTY;
|
||||||
int time;
|
int time;
|
||||||
void __user *argp = (void __user *)arg;
|
void __user *argp = (void __user *)arg;
|
||||||
int __user *p = argp;
|
int __user *p = argp;
|
||||||
|
@ -235,7 +235,7 @@ static int fop_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
|
|||||||
switch(cmd)
|
switch(cmd)
|
||||||
{
|
{
|
||||||
default:
|
default:
|
||||||
return -ENOIOCTLCMD;
|
return -ENOTTY;
|
||||||
case WDIOC_GETSUPPORT:
|
case WDIOC_GETSUPPORT:
|
||||||
return copy_to_user(argp, &ident, sizeof(ident))?-EFAULT:0;
|
return copy_to_user(argp, &ident, sizeof(ident))?-EFAULT:0;
|
||||||
case WDIOC_GETSTATUS:
|
case WDIOC_GETSTATUS:
|
||||||
|
@ -141,7 +141,7 @@ static int epx_c3_ioctl(struct inode *inode, struct file *file,
|
|||||||
|
|
||||||
return retval;
|
return retval;
|
||||||
default:
|
default:
|
||||||
return -ENOIOCTLCMD;
|
return -ENOTTY;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -180,7 +180,7 @@ static int sc1200wdt_ioctl(struct inode *inode, struct file *file, unsigned int
|
|||||||
|
|
||||||
switch (cmd) {
|
switch (cmd) {
|
||||||
default:
|
default:
|
||||||
return -ENOIOCTLCMD; /* Keep Pavel Machek amused ;) */
|
return -ENOTTY;
|
||||||
|
|
||||||
case WDIOC_GETSUPPORT:
|
case WDIOC_GETSUPPORT:
|
||||||
if (copy_to_user(argp, &ident, sizeof ident))
|
if (copy_to_user(argp, &ident, sizeof ident))
|
||||||
|
@ -290,7 +290,7 @@ static int fop_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
|
|||||||
switch(cmd)
|
switch(cmd)
|
||||||
{
|
{
|
||||||
default:
|
default:
|
||||||
return -ENOIOCTLCMD;
|
return -ENOTTY;
|
||||||
case WDIOC_GETSUPPORT:
|
case WDIOC_GETSUPPORT:
|
||||||
return copy_to_user(argp, &ident, sizeof(ident))?-EFAULT:0;
|
return copy_to_user(argp, &ident, sizeof(ident))?-EFAULT:0;
|
||||||
case WDIOC_GETSTATUS:
|
case WDIOC_GETSTATUS:
|
||||||
|
@ -166,7 +166,7 @@ static int scx200_wdt_ioctl(struct inode *inode, struct file *file,
|
|||||||
|
|
||||||
switch (cmd) {
|
switch (cmd) {
|
||||||
default:
|
default:
|
||||||
return -ENOIOCTLCMD;
|
return -ENOTTY;
|
||||||
case WDIOC_GETSUPPORT:
|
case WDIOC_GETSUPPORT:
|
||||||
if(copy_to_user(argp, &ident, sizeof(ident)))
|
if(copy_to_user(argp, &ident, sizeof(ident)))
|
||||||
return -EFAULT;
|
return -EFAULT;
|
||||||
|
@ -360,7 +360,7 @@ static int sh_wdt_ioctl(struct inode *inode, struct file *file,
|
|||||||
|
|
||||||
return retval;
|
return retval;
|
||||||
default:
|
default:
|
||||||
return -ENOIOCTLCMD;
|
return -ENOTTY;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -203,7 +203,7 @@ static int softdog_ioctl(struct inode *inode, struct file *file,
|
|||||||
};
|
};
|
||||||
switch (cmd) {
|
switch (cmd) {
|
||||||
default:
|
default:
|
||||||
return -ENOIOCTLCMD;
|
return -ENOTTY;
|
||||||
case WDIOC_GETSUPPORT:
|
case WDIOC_GETSUPPORT:
|
||||||
return copy_to_user(argp, &ident,
|
return copy_to_user(argp, &ident,
|
||||||
sizeof(ident)) ? -EFAULT : 0;
|
sizeof(ident)) ? -EFAULT : 0;
|
||||||
|
@ -223,7 +223,7 @@ wdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
|
|||||||
}
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return -ENOIOCTLCMD;
|
return -ENOTTY;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -252,7 +252,7 @@ static int fop_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
|
|||||||
switch(cmd)
|
switch(cmd)
|
||||||
{
|
{
|
||||||
default:
|
default:
|
||||||
return -ENOIOCTLCMD;
|
return -ENOTTY;
|
||||||
case WDIOC_GETSUPPORT:
|
case WDIOC_GETSUPPORT:
|
||||||
return copy_to_user(argp, &ident, sizeof(ident))?-EFAULT:0;
|
return copy_to_user(argp, &ident, sizeof(ident))?-EFAULT:0;
|
||||||
case WDIOC_GETSTATUS:
|
case WDIOC_GETSTATUS:
|
||||||
|
@ -393,7 +393,7 @@ static int wdt_ioctl(struct inode *inode, struct file *file,
|
|||||||
switch(cmd)
|
switch(cmd)
|
||||||
{
|
{
|
||||||
default:
|
default:
|
||||||
return -ENOIOCTLCMD;
|
return -ENOTTY;
|
||||||
|
|
||||||
case WDIOC_GETSUPPORT:
|
case WDIOC_GETSUPPORT:
|
||||||
return copy_to_user(uarg.ident, &ident, sizeof(ident)) ? -EFAULT : 0;
|
return copy_to_user(uarg.ident, &ident, sizeof(ident)) ? -EFAULT : 0;
|
||||||
|
@ -174,7 +174,7 @@ static int wafwdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd
|
|||||||
}
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return -ENOIOCTLCMD;
|
return -ENOTTY;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -385,7 +385,7 @@ wdrtas_ioctl(struct inode *inode, struct file *file,
|
|||||||
return put_user(wdrtas_interval, argp);
|
return put_user(wdrtas_interval, argp);
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return -ENOIOCTLCMD;
|
return -ENOTTY;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -341,7 +341,7 @@ static int wdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
|
|||||||
switch(cmd)
|
switch(cmd)
|
||||||
{
|
{
|
||||||
default:
|
default:
|
||||||
return -ENOIOCTLCMD;
|
return -ENOTTY;
|
||||||
case WDIOC_GETSUPPORT:
|
case WDIOC_GETSUPPORT:
|
||||||
return copy_to_user(argp, &ident, sizeof(ident))?-EFAULT:0;
|
return copy_to_user(argp, &ident, sizeof(ident))?-EFAULT:0;
|
||||||
|
|
||||||
|
@ -137,7 +137,7 @@ watchdog_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
|
|||||||
unsigned long arg)
|
unsigned long arg)
|
||||||
{
|
{
|
||||||
unsigned int new_margin;
|
unsigned int new_margin;
|
||||||
int ret = -ENOIOCTLCMD;
|
int ret = -ENOTTY;
|
||||||
|
|
||||||
switch(cmd) {
|
switch(cmd) {
|
||||||
case WDIOC_GETSUPPORT:
|
case WDIOC_GETSUPPORT:
|
||||||
|
@ -361,7 +361,7 @@ static int wdt977_ioctl(struct inode *inode, struct file *file,
|
|||||||
switch(cmd)
|
switch(cmd)
|
||||||
{
|
{
|
||||||
default:
|
default:
|
||||||
return -ENOIOCTLCMD;
|
return -ENOTTY;
|
||||||
|
|
||||||
case WDIOC_GETSUPPORT:
|
case WDIOC_GETSUPPORT:
|
||||||
return copy_to_user(uarg.ident, &ident,
|
return copy_to_user(uarg.ident, &ident,
|
||||||
|
@ -386,7 +386,7 @@ static int wdtpci_ioctl(struct inode *inode, struct file *file, unsigned int cmd
|
|||||||
switch(cmd)
|
switch(cmd)
|
||||||
{
|
{
|
||||||
default:
|
default:
|
||||||
return -ENOIOCTLCMD;
|
return -ENOTTY;
|
||||||
case WDIOC_GETSUPPORT:
|
case WDIOC_GETSUPPORT:
|
||||||
return copy_to_user(argp, &ident, sizeof(ident))?-EFAULT:0;
|
return copy_to_user(argp, &ident, sizeof(ident))?-EFAULT:0;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user