cifs: return error on invalid value written to cifsFYI

Message ID 20180523235149.31764-1-lsahlber@redhat.com
State New
Headers show
Series
  • cifs: return error on invalid value written to cifsFYI
Related show

Commit Message

Ronnie Sahlberg May 23, 2018, 11:51 p.m.
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>
---
 fs/cifs/cifs_debug.c | 2 ++
 1 file changed, 2 insertions(+)

Patch

diff --git a/fs/cifs/cifs_debug.c b/fs/cifs/cifs_debug.c
index 9d69ea433330..d8825906d8bf 100644
--- a/fs/cifs/cifs_debug.c
+++ b/fs/cifs/cifs_debug.c
@@ -583,6 +583,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;
 }