mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Peter Teoh" <htmldeveloper@gmail.com>
To: LKML <linux-kernel@vger.kernel.org>
Subject: Unmatched semaphore usage in fs/super.c
Date: Sun, 2 Mar 2008 15:10:35 +0800	[thread overview]
Message-ID: <804dabb00803012310s7b76e09bqc6d96c25e0618cf9@mail.gmail.com> (raw)

Please pardon me if wrong.   In fs/super.c, I saw a down_read()
without a matching (when sb->s_root is non-zero) up_read() as shown
below:

/**
 *      get_super - get the superblock of a device
 *      @bdev: device to get the superblock for
 *
 *      Scans the superblock list and finds the superblock of the file system
 *      mounted on the device given. %NULL is returned if no match is found.
 */

struct super_block * get_super(struct block_device *bdev)
{
       struct super_block *sb;

       if (!bdev)
               return NULL;

       spin_lock(&sb_lock);
rescan:
       list_for_each_entry(sb, &super_blocks, s_list) {
               if (sb->s_bdev == bdev) {
                       sb->s_count++;
                       spin_unlock(&sb_lock);
                       down_read(&sb->s_umount);
                       if (sb->s_root)
                               return sb;
                       up_read(&sb->s_umount);
                       /* restart only when sb is no longer on the list */
                       spin_lock(&sb_lock);
                       if (__put_super_and_need_restart(sb))
                               goto rescan;
               }
       }
       spin_unlock(&sb_lock);
       return NULL;
}

Neither did the get_super() caller remember and correct the semaphore
either.   Is this a problem?

             reply	other threads:[~2008-03-02  7:10 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-03-02  7:10 Peter Teoh [this message]
2008-03-02  7:58 ` 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=804dabb00803012310s7b76e09bqc6d96c25e0618cf9@mail.gmail.com \
    --to=htmldeveloper@gmail.com \
    --cc=linux-kernel@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®