Linux CIFS filesystem development
 help / color / mirror / Atom feed
From: Sachin Prabhu <sprabhu-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
To: Linux CIFS mailing list
	<linux-cifs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>
Cc: Chris Clayton <chris2553-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org>
Subject: [PATCH] Fix number parsing in cifs_parse_mount_options
Date: Fri, 13 Apr 2012 14:04:32 +0100	[thread overview]
Message-ID: <1334322272.2308.1.camel@localhost> (raw)
In-Reply-To: <201204130712.51693.chris2553-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org>

The function kstrtoul() used to parse number strings in the mount
option parser is set to expect a base 10 number . This treats the octal
numbers passed for mount options such as file_mode as base10 numbers
leading to incorrect behavior.

Change the 'base' argument passed to kstrtoul from 10 to 0 to
allow it to auto-detect the base of the number passed.

Signed-off-by: Sachin Prabhu <sprabhu-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
Reported-by: Chris Clayton <chris2553-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org>

---
 fs/cifs/connect.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
index 6a86f3d..f31dc9a 100644
--- a/fs/cifs/connect.c
+++ b/fs/cifs/connect.c
@@ -1123,7 +1123,7 @@ static int get_option_ul(substring_t args[], unsigned long *option)
 	string = match_strdup(args);
 	if (string == NULL)
 		return -ENOMEM;
-	rc = kstrtoul(string, 10, option);
+	rc = kstrtoul(string, 0, option);
 	kfree(string);
 
 	return rc;
-- 
1.7.7.6

  parent reply	other threads:[~2012-04-13 13:04 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-13  6:12 3.4.0-rc2+: CIFS - strange file modes Chris Clayton
     [not found] ` <201204130712.51693.chris2553-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org>
2012-04-13 13:04   ` Sachin Prabhu [this message]
2012-04-13 13:17     ` [PATCH] Fix number parsing in cifs_parse_mount_options Jeff Layton
     [not found]       ` <20120413091753.60dccc93-9yPaYZwiELC+kQycOl6kW4xkIHaj4LzF@public.gmane.org>
2012-04-13 15:03         ` Steve French
2012-04-13 21:47     ` Chris Clayton

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1334322272.2308.1.camel@localhost \
    --to=sprabhu-h+wxahxf7alqt0dzr+alfa@public.gmane.org \
    --cc=chris2553-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org \
    --cc=linux-cifs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox