aboutsummaryrefslogtreecommitdiffstats
path: root/fs/cifs
diff options
context:
space:
mode:
Diffstat (limited to 'fs/cifs')
-rw-r--r--fs/cifs/cifs_debug.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/fs/cifs/cifs_debug.c b/fs/cifs/cifs_debug.c
index d59748346020..856f8f5fc295 100644
--- a/fs/cifs/cifs_debug.c
+++ b/fs/cifs/cifs_debug.c
@@ -598,6 +598,7 @@ static int cifs_security_flags_proc_open(struct inode *inode, struct file *file)
598static ssize_t cifs_security_flags_proc_write(struct file *file, 598static ssize_t cifs_security_flags_proc_write(struct file *file,
599 const char __user *buffer, size_t count, loff_t *ppos) 599 const char __user *buffer, size_t count, loff_t *ppos)
600{ 600{
601 int rc;
601 unsigned int flags; 602 unsigned int flags;
602 char flags_string[12]; 603 char flags_string[12];
603 char c; 604 char c;
@@ -620,26 +621,33 @@ static ssize_t cifs_security_flags_proc_write(struct file *file,
620 global_secflags = CIFSSEC_MAX; 621 global_secflags = CIFSSEC_MAX;
621 return count; 622 return count;
622 } else if (!isdigit(c)) { 623 } else if (!isdigit(c)) {
623 cifs_dbg(VFS, "invalid flag %c\n", c); 624 cifs_dbg(VFS, "Invalid SecurityFlags: %s\n",
625 flags_string);
624 return -EINVAL; 626 return -EINVAL;
625 } 627 }
626 } 628 }
627 /* else we have a number */
628 629
629 flags = simple_strtoul(flags_string, NULL, 0); 630 /* else we have a number */
631 rc = kstrtouint(flags_string, 0, &flags);
632 if (rc) {
633 cifs_dbg(VFS, "Invalid SecurityFlags: %s\n",
634 flags_string);
635 return rc;
636 }
630 637
631 cifs_dbg(FYI, "sec flags 0x%x\n", flags); 638 cifs_dbg(FYI, "sec flags 0x%x\n", flags);
632 639
633 if (flags <= 0) { 640 if (flags == 0) {
634 cifs_dbg(VFS, "invalid security flags %s\n", flags_string); 641 cifs_dbg(VFS, "Invalid SecurityFlags: %s\n", flags_string);
635 return -EINVAL; 642 return -EINVAL;
636 } 643 }
637 644
638 if (flags & ~CIFSSEC_MASK) { 645 if (flags & ~CIFSSEC_MASK) {
639 cifs_dbg(VFS, "attempt to set unsupported security flags 0x%x\n", 646 cifs_dbg(VFS, "Unsupported security flags: 0x%x\n",
640 flags & ~CIFSSEC_MASK); 647 flags & ~CIFSSEC_MASK);
641 return -EINVAL; 648 return -EINVAL;
642 } 649 }
650
643 /* flags look ok - update the global security flags for cifs module */ 651 /* flags look ok - update the global security flags for cifs module */
644 global_secflags = flags; 652 global_secflags = flags;
645 if (global_secflags & CIFSSEC_MUST_SIGN) { 653 if (global_secflags & CIFSSEC_MUST_SIGN) {