mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Richard Gooch <rgooch@ras.ucalgary.ca>
To: Russell King <rmk@arm.linux.org.uk>
Cc: linux-kernel@vger.kernel.org
Subject: Re: devfs: BKL *not* taken while opening devices
Date: Fri, 10 May 2002 18:45:23 -0600	[thread overview]
Message-ID: <200205110045.g4B0jND21147@vindaloo.ras.ucalgary.ca> (raw)
In-Reply-To: <20020429141301.B16778@flint.arm.linux.org.uk>

Russell King writes:
> Hi,
> 
> Nice simple bug report.
> 
> Kernel 2.5.8... Devfs devfs_open() bypasses the normal chrdev_open and
> blkdev_open functions, and misses out taking the BKL.  2.5.10 is the
> same.
> 
> Certainly the tty layer (and probably many of the other devices as well)
> require the BKL to be taken before calling the open method.

Yes, I'll be submitting a patch to fix this.

> Also, the following looks wrong:
> 
>     if ( S_ISBLK (inode->i_mode) )
>     {
>         file->f_op = &def_blk_fops;
>         if (df->ops) inode->i_bdev->bd_op = df->ops;
>     }
>     else file->f_op = fops_get ( (struct file_operations *) df->ops );
>     if (file->f_op)
>         err = file->f_op->open ? (*file->f_op->open) (inode, file) : 0;
>     else
>     {
>         /*  Fallback to legacy scheme  */
>         if ( S_ISCHR (inode->i_mode) ) err = chrdev_open (inode, file);
>         else err = -ENODEV;
>     }
>     if (err < 0) return err;
> 
> We can return without releasing the file operations after fops_get(),
> thereby effectively locking modules in memory.

How is this different from the chrdev_open() logic? It seems to me
this is taken care of in fput(), so no need to worry.

				Regards,

					Richard....
Permanent: rgooch@atnf.csiro.au
Current:   rgooch@ras.ucalgary.ca

      parent reply	other threads:[~2002-05-11  0:45 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-04-29 13:13 Russell King
2002-04-29 15:30 ` Dave Hansen
2002-04-29 17:21   ` Arjan van de Ven
2002-04-29 17:40     ` Roman Zippel
2002-04-29 17:46       ` Arjan van de Ven
2002-05-02 16:44         ` Alan Cox
2002-04-29 17:52       ` Dave Hansen
2002-04-30 12:45     ` Russell King
2002-04-30 16:42       ` Dave Hansen
2002-04-30 16:52         ` Arjan van de Ven
2002-04-30 16:58           ` Dave Hansen
2002-04-30 18:26           ` Martin J. Bligh
2002-04-30 17:03         ` Russell King
2002-05-11  0:45 ` Richard Gooch [this message]

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=200205110045.g4B0jND21147@vindaloo.ras.ucalgary.ca \
    --to=rgooch@ras.ucalgary.ca \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rmk@arm.linux.org.uk \
    /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®