Re: 2.6.0-test6 crash while reading files in /proc/fs/reiserfs/sda1

viro
2003-10-01T18:43:42Z

On Wed, Oct 01, 2003 at 09:54:44PM +0400, Nikita Danilov wrote:

> Cannot help but describe a little detail: r_stop() erroneously thought
> that de->data contains a pointer to the super block, while in reality
> address of some fs/reiserfs/procfs.c:show_* function was stored
> there. As a result, deactivate_super() danced fine fandango on core, in
> particular, in the case of show_oidmap() it modified first assignment
> within loop to reset loop counter back to zero.

*Ouch*

Thanks for spotting. IMO there's an easier fix, though - I see what you
do with ERR_PTR() and it's a clever way to pass information, but it would
be much more straightforward to have the following:

r_start() - as now

static void *r_next(struct seq_file *m, void *v, loff_t *pos)
{
++*pos;
if (v)
deactivate_super(v);
return NULL;
}

static void r_stop(struct seq_file *m, void *v)
{
if (v)
deactivate_super(v);
}

r_show() - as now.

We don't need to crawl in de->... guts past that point in ->start() - after
all, past that point we'll have a pointer to our superblock passed as argument.