cifs: return error on invalid value written to cifsFYI
authorRonnie Sahlberg <lsahlber@redhat.com>
Wed, 23 May 2018 23:53:39 +0000 (09:53 +1000)
committerSteve French <stfrench@microsoft.com>
Wed, 30 May 2018 21:06:18 +0000 (16:06 -0500)
RHBZ: 1539617

Check that, if it is not a boolean, the value the user tries
to write to /proc/fs/cifs/cifsFYI is valid and return an error
if not.

Signed-off-by: Ronnie Sahlberg <lsahlber@redhat.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
Reported-by: Xiaoli Feng <xifeng@redhat.com>
fs/cifs/cifs_debug.c

index e6025e93c5eb01795d59cdf50ada7fd43c9b60ad..ef93d60ca4166a223d090bf6b0ec19e673cf3a70 100644 (file)
@@ -584,6 +584,8 @@ static ssize_t cifsFYI_proc_write(struct file *file, const char __user *buffer,
                cifsFYI = bv;
        else if ((c[0] > '1') && (c[0] <= '9'))
                cifsFYI = (int) (c[0] - '0'); /* see cifs_debug.h for meanings */
+       else
+               return -EINVAL;
 
        return count;
 }