public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Horms <horms@debian.org>
To: Marcelo Tosatti <marcelo.tosatti@cyclades.com>,
	Alexander Pytlev <apytlev@tut.by>,
	linux-kernel@vger.kernel.org, debian-kernel@lists.debian.org,
	"Andrey J. Melnikoff (TEMHOTA)" <temnota@kmv.ru>,
	Willy Tarreau <willy@w.ods.org>
Subject: Re: kernel 2.4.27-10: isofs driver ignore some parameters with mount
Date: Tue, 16 Aug 2005 17:38:09 +0900	[thread overview]
Message-ID: <20050816083807.GA31717@debian.org> (raw)
In-Reply-To: <20050816053121.GD11925@verge.net.au>

Hi,

On Marcelo's request I have taken a closer look at this.
It seems that Alexander Pytlev's original (simple) patch was correct.

Without it the logic looks a bit like this.

while (...) {
	if iocharset
		...
	else if map
		...
	if session
		...
	if sbsector
		...
	else if check
		...
		...
	else
		return 1;
}

Now, if iocharset, map or session are matched, then none of the if or
else if clauses under sbsector will match (that is none of these clauses
match iocharset, map or session), and thus the else clause will be hit,
and the function will return 1 without parsing any furhter options.

With Alexander's fix, the if session and if sbsector clauses
become else if, and its easy to see that the return 1 won't
be premeturely called.

I have tested that this patch works using the testcase options
iocharset=koi8-r,gid=100, and checking that gid is set correctly
with the patch, and incorrectly without.

Here is the patch and signoff again, just for the record.
I will send a second patch to clean up the *value = 0 code
that Marcelo cast concerns over - its bogus but harmless.

Signed-off-by: Horms <horms@verge.net.au>

--- a/fs/isofs/inode.c	2005-08-03 14:46:33.000000000 +0900
+++ b/fs/isofs/inode.c	2005-08-16 17:23:04.000000000 +0900
@@ -340,13 +337,13 @@
 			else if (!strcmp(value,"acorn")) popt->map = 'a';
 			else return 0;
 		}
-		if (!strcmp(this_char,"session") && value) {
+		else if (!strcmp(this_char,"session") && value) {
 			char * vpnt = value;
 			unsigned int ivalue = simple_strtoul(vpnt, &vpnt, 0);
 			if(ivalue < 0 || ivalue >99) return 0;
 			popt->session=ivalue+1;
 		}
-		if (!strcmp(this_char,"sbsector") && value) {
+		else if (!strcmp(this_char,"sbsector") && value) {
 			char * vpnt = value;
 			unsigned int ivalue = simple_strtoul(vpnt, &vpnt, 0);
 			if(ivalue < 0 || ivalue >660*512) return 0;

  reply	other threads:[~2005-08-16  8:46 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1853917171.20050812104417@tut.by>
2005-08-12  8:29 ` kernel 2.4.27-10: isofs driver ignore some parameters with mount Horms
2005-08-12  8:41   ` Horms
2005-08-16  1:11   ` Marcelo Tosatti
2005-08-16  5:31     ` Horms
2005-08-16  8:38       ` Horms [this message]
2005-08-16  8:46         ` [PATCH] Bogus code in parsing of iocharset in isofs Horms

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=20050816083807.GA31717@debian.org \
    --to=horms@debian.org \
    --cc=apytlev@tut.by \
    --cc=debian-kernel@lists.debian.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marcelo.tosatti@cyclades.com \
    --cc=temnota@kmv.ru \
    --cc=willy@w.ods.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