All of lore.kernel.org
 help / color / mirror / Atom feed
From: Al Viro <viro@ZenIV.linux.org.uk>
To: Xiaotian Feng <xtfeng@gmail.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>,
	linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org
Subject: Re: [git pull] mnt_devname queue
Date: Thu, 17 Mar 2011 07:23:44 +0000	[thread overview]
Message-ID: <20110317072344.GZ22723@ZenIV.linux.org.uk> (raw)
In-Reply-To: <AANLkTimF9ExskxBmebk7X2=g5S6OK5vAa05G1cgeVVCP@mail.gmail.com>

On Thu, Mar 17, 2011 at 01:45:33PM +0800, Xiaotian Feng wrote:

> I guess we need also switch pstore from ->get_sb() to ->mount()
> 
> fs/pstore/inode.c:253: error: unknown field ???get_sb??? specified in initializer
> fs/pstore/inode.c:253: warning: initialization makes integer from
> pointer without a cast
> fs/pstore/inode.c:253: error: initializer element is not computable at load time
> fs/pstore/inode.c:253: error: (near initialization for
> ???pstore_fs_type.fs_flags???)

Yes.  I've just looked at that thing and I see several, er, issues.

a) What the hell would you expect to happen if userland mounts it twice
and unmount the first one?  pstore_sb = NULL, pstore_mnt = NULL, AFAICS.

b) pstore_writefile() - struct file on stack?  Really?  Again, in the
scenario above, what'll happen to you if pstore_mnt gets dropped and
freed in the middle of all that?

c) in the same function:
+       memset(&f, '0', sizeof f);
Ahem...

d)
+               if (pstore_is_mounted())
+                       pstore_mkfile(PSTORE_TYPE_DMESG, psinfo->name, id,
+                                     psinfo->buf, hsize + l1_cpy + l2_cpy,
+                                     CURRENT_TIME, psinfo->erase);

And what happens if it's unmounted between the check and use?  pstore_mkfile()
pretty much starts with dereferencing pstore_sb...

e) as the matter of fact, what happens if it's unmounted in the _middle_ of
pstore_mkfile()?

f) in general it's a lousy policy to tie that kind of difference in behaviour
to "somebody has it mounted someplace at the moment", even without the races
a-la (a)...

  reply	other threads:[~2011-03-17  7:23 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-16 23:56 [git pull] mnt_devname queue Al Viro
2011-03-17  5:45 ` Xiaotian Feng
2011-03-17  5:45   ` Xiaotian Feng
2011-03-17  7:23   ` Al Viro [this message]
2011-03-17  7:28     ` Xiaotian Feng
2011-03-17 10:44       ` Al Viro
2011-03-17 19:08         ` Tony Luck
2011-03-17 21:35         ` Some fixes for pstore (Was Re: [git pull] mnt_devname queue) Tony Luck
2011-03-17 22:42           ` Al Viro
2011-03-17 22:48             ` Tony Luck
2011-03-17 22:48               ` Tony Luck
2011-03-17 22:56               ` Al Viro
2011-03-18 18:44         ` pstore: fix leaking ->i_private Luck, Tony
2011-03-18 18:49           ` Christoph Hellwig
2011-03-18 18:55             ` Tony Luck
2011-03-18 18:55               ` Tony Luck
2011-03-18 22:33             ` pstore: use mount option instead sysfs to tweak kmsg_bytes Luck, Tony
2011-03-18 18:57           ` pstore: fix leaking ->i_private Al Viro
2011-03-17 23:29 ` Some fixes for pstore (Was Re: [git pull] mnt_devname queue) Tony Luck
2011-03-18  0:07   ` Al Viro

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=20110317072344.GZ22723@ZenIV.linux.org.uk \
    --to=viro@zeniv.linux.org.uk \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@linux-foundation.org \
    --cc=xtfeng@gmail.com \
    /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.