From: Al Viro <viro@ZenIV.linux.org.uk>
To: Kai Bankett <chaosman@ontika.net>
Cc: linux-fsdevel@vger.kernel.org
Subject: Re: [PATCH]QNX6 filesystem (RO) driver
Date: Tue, 21 Feb 2012 22:04:55 +0000 [thread overview]
Message-ID: <20120221220455.GT23916@ZenIV.linux.org.uk> (raw)
In-Reply-To: <4F3EC8C4.3050707@ontika.net>
On Fri, Feb 17, 2012 at 10:38:12PM +0100, Kai Bankett wrote:
> At least code was robust enough to deal with it ;)
> I guess ino was set to 0 anyways by compiler? At least it does not
> seem to have been sort of random.
Nope. Uninitialized is uninitialized - in reality it's "whatever happens
to be in that word on stack", in theory it's "compiler has every right
to do _anything_ to reads from it". Nasal daemon country...
> Otherwise testing would have shown strange effects - right?
Depends.
> http://a6.ontika.net/patches/0001-fs-initial-qnx6fs-addition.patch.gz
Still a problem with memcmp() use in qnx6_long_match() - suppose you've
got lf_size (on corrupt fs) set to 3Kb. With 2Kb blocks and odd
->de_long_inode. You are doing a lookup for 3Kb name. What we get is
qnx6_longname() returning a pointer 2Kb into 4Kb page. And qnx6_long_match()
proceeding to do memcmp() on 3Kb starting from that point. Oops - literally.
What we need to do is either
* silently return 0 on thislen > QNX6_LONG_NAME_MAX, or
* return 0 and yell about corrupt /longfiles, or
* have qnx6_lookup() check that len <= QNX6_LONG_NAME_MAX and
return ERR_PTR(-ENAMETOOLONG) if it isn't. And lose the thislen check
completely.
I'd probably go for the last variant; it's consistent with what other
filesystems are doing and it would avoid mess if we ever try to do
r/w variant. BTW, thislen check in qnx6_match() is also pointless -
we'd already checked that in caller. Otherwise it would be wrong in
the same way as for long ones...
next prev parent reply other threads:[~2012-02-21 22:04 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-02-01 20:41 [PATCH]QNX6 filesystem (RO) driver Kai Bankett
2012-02-12 4:56 ` Al Viro
2012-02-12 22:14 ` Kai Bankett
2012-02-12 22:43 ` Al Viro
2012-02-15 2:52 ` Kai Bankett
2012-02-15 6:10 ` Al Viro
2012-02-15 6:14 ` Al Viro
2012-02-15 6:47 ` Al Viro
2012-02-15 7:11 ` Al Viro
2012-02-15 7:57 ` Al Viro
2012-02-15 14:40 ` Al Viro
2012-02-15 16:27 ` Kai Bankett
2012-02-15 21:35 ` Al Viro
2012-02-16 10:00 ` Al Viro
2012-02-17 15:06 ` Kai Bankett
2012-02-17 16:20 ` Al Viro
2012-02-17 17:53 ` Kai Bankett
2012-02-17 18:35 ` Al Viro
2012-02-17 18:53 ` Al Viro
2012-02-17 21:38 ` Kai Bankett
2012-02-21 22:04 ` Al Viro [this message]
2012-02-21 22:09 ` Al Viro
2012-02-22 11:58 ` Kai Bankett
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=20120221220455.GT23916@ZenIV.linux.org.uk \
--to=viro@zeniv.linux.org.uk \
--cc=chaosman@ontika.net \
--cc=linux-fsdevel@vger.kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.