Re: Problems with modules in 2.3.51

From: Alexander Viro (viro@math.psu.edu)
Date: Sat Mar 11 2000 - 06:26:42 EST

  • Next message: Tim Waugh: "Re: 2.3: pci_dev.driver"

    On Sat, 11 Mar 2000, Roman V. Shaposhnick wrote:

    > Hi,
    >
    > I would like to mention that in 2.3.51 there is a huge problem with
    > modules related to recent changes in fs-register-unregister interface.
    >
    > First let's see the bug itself:
    [snip]
    > yellow:/usr/src/linux/fs/isofs # mount /dev/hdc /cdrom
    > mount: block device /dev/hdc is write-protected, mounting read-only
    > yellow:/usr/src/linux/fs/isofs # lsmod
    > Module Size Used by
    > isofs 19164 3

    Oh, fsck! OK, I see what happens. get_fs_type() grabs the reference to
    module (as it should). However, we call it in sys_mount() and then in
    do_mount(). Reference obtained in the latter is properly handled, no
    problems here (either retained or dropped, depending on results of
    ->read_super()). But reference from call in sys_mount() is a leak.
    And since you didn't say -o ro mount(8) called mount(2) twice. Resulting
    in reference counter 3: 1 from successful mount + 2 leaked.

    Oh, well... Fix being:
    --- linux-2.3.51/fs/super.c Sat Mar 11 01:33:11 2000
    +++ linux-bird.vfs/fs/super.c Sat Mar 11 06:21:54 2000
    @@ -1134,7 +1134,7 @@
                    dentry = namei(dev_name);
                    retval = PTR_ERR(dentry);
                    if (IS_ERR(dentry))
    - goto out;
    + goto fs_out;

                    inode = dentry->d_inode;
                    retval = -ENOTBLK;
    @@ -1163,6 +1163,8 @@

     dput_and_out:
            dput(dentry);
    +fs_out:
    + put_filesystem(fstype);
     out:
            unlock_kernel();
            return retval;

    Linus, could you apply it?

    -
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.rutgers.edu
    Please read the FAQ at http://www.tux.org/lkml/



    This archive was generated by hypermail 2b29 : Sat Mar 11 2000 - 06:32:25 EST