lkml.org 
[lkml]   [2012]   [Mar]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    SubjectRe: [PATCH] fs: Fix mod_timer crash when removing USB sticks
    From
    On Fri, Mar 16, 2012 at 10:36 AM, Greg KH <greg@kroah.com> wrote:
    >
    > On Thu, Jan 12, 2012 at 01:57:11PM -0800, Paul Taysom wrote:
    > > A USB stick with a ext file system on it, would occasionally crash
    > > when the stick was pulled.
    > >
    > > The problem was a timer was being set on the Backing Device Interface,
    > > bdi, after the USB device had been removed and the bdi had been
    > > unregistered. The bdi would then be later reinitialized by zeroing
    > > the timer without removing from the timer from the timer queue.
    > > This would eventually result in a kernel crash (NULL ptr dereference).
    > >
    > > When the bdi is unregistered, the dev field is set to NULL. This
    > > indication is used by bdi_unregister to only unregister the device
    > > once.
    > >
    > > Fix: When the backing device is invalidated, the mapping
    > > backing_dev_info
    > > should be redirected to the default_backing_dev_info.
    > >
    > > Created 3 USB sticks with ext2, ext4 and one with both apple and DOS
    > > file systems on it. Inserted and removed USB sticks many times in random
    > > order. With out the bug fix, the kernel would soon crash. With the fix,
    > > it did not. Ran on both stumpy and amd64-generic.
    > >
    > > Signed-off-by: Paul Taysom <taysom@chromium.org>
    > > Cc: Mandeep Baines <msb@chromium.org>
    > > Cc: Greg KH <greg@kroah.com>
    > > Cc: Jens Axboe <axboe@kernel.dk>
    > > Cc: Theodore Tso <tytso@google.com>
    > > Cc: Andrew Morton <akpm@google.com>
    > > Cc: <linux-usb@vger.kernel.org>
    > > Cc: <linux-kernel@vger.kernel.org>
    > > Cc: Alexander Viro <viro@zeniv.linux.org.uk>
    > > Cc: <linux-fsdevel@vger.kernel.org>
    > > Cc: <stable@kernel.org>
    > > ---
    > >  fs/block_dev.c |    1 +
    > >  1 files changed, 1 insertions(+), 0 deletions(-)
    > >
    > > diff --git a/fs/block_dev.c b/fs/block_dev.c
    > > index afe74dd..322cd05 100644
    > > --- a/fs/block_dev.c
    > > +++ b/fs/block_dev.c
    > > @@ -110,6 +110,7 @@ void invalidate_bdev(struct block_device *bdev)
    > >        * But, for the strange corners, lets be cautious
    > >        */
    > >       cleancache_flush_inode(mapping);
    > > +     mapping->backing_dev_info = &default_backing_dev_info;
    > >  }
    > >  EXPORT_SYMBOL(invalidate_bdev);
    >
    > What ever happened to this patch?  Is it still needed?  Can you still
    > reproduce the problem on Linus's tree and older kernels?
    >


    Never heard anything back. Ted supplied a partial fix in 3.2.6 (I
    believe) for just the ext4 file system. Who should I follow up with?
    Thanks,
    Paul
    --
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/

    \
     
     \ /
      Last update: 2012-03-16 20:31    [W:0.044 / U:28.996 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site