From: Andrew Morton <akpm@linux-foundation.org>
To: Matthias Kaehlcke <matthias.kaehlcke@gmail.com>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
kkeil@suse.de, kai.germaschewski@gmx.de,
isdn4linux@listserv.isdn4linux.de
Subject: Re: [PATCH] fixed spinlock use in hysdn_log_close()
Date: Fri, 20 Apr 2007 17:41:46 -0700 [thread overview]
Message-ID: <20070420174146.42ccd6b4.akpm@linux-foundation.org> (raw)
In-Reply-To: <20070411170907.GO24898@traven>
On Sat, 14 Apr 2007 07:09:07 +0200
Matthias Kaehlcke <matthias.kaehlcke@gmail.com> wrote:
> fixed incorrect spinlock use in hysdn_log_close(). the function
> declared a spinlock on the stack and used it to 'protect' a shared
> driver structure. the patch removes the declaration of hysdn_lock and
> uses card->hysdn_lock instead.
>
Interesting.
>
> ---
> diff --git a/drivers/isdn/hysdn/hysdn_proclog.c b/drivers/isdn/hysdn/hysdn_proclog.c
> index f7e83a8..32f0b75 100644
> --- a/drivers/isdn/hysdn/hysdn_proclog.c
> +++ b/drivers/isdn/hysdn/hysdn_proclog.c
> @@ -299,7 +299,6 @@ hysdn_log_close(struct inode *ino, struct file *filep)
> hysdn_card *card;
> int retval = 0;
> unsigned long flags;
> - spinlock_t hysdn_lock = SPIN_LOCK_UNLOCKED;
>
> lock_kernel();
> if ((filep->f_mode & (FMODE_READ | FMODE_WRITE)) == FMODE_WRITE) {
> @@ -309,7 +308,7 @@ hysdn_log_close(struct inode *ino, struct file *filep)
> /* read access -> log/debug read, mark one further file as closed */
>
> pd = NULL;
> - spin_lock_irqsave(&hysdn_lock, flags);
> + spin_lock_irqsave(&card->hysdn_lock, flags);
I guess it won't hurt - are you actually able to test this code?
afaict most of the data in there is locked with lock_kernel(), if it's
locked at all.
If you had some runtime problem and this patch fixed it then fine. If
however you're not able to test this code then perhaps the safest option is
to simply remove that locking altogether, which is pretty much a
runtime-equivalent change.
next prev parent reply other threads:[~2007-04-21 0:42 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-04-14 5:09 [PATCH] fixed spinlock use in hysdn_log_close() Matthias Kaehlcke
2007-04-21 0:41 ` Andrew Morton [this message]
2007-04-21 15:11 ` Matthias Kaehlcke
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=20070420174146.42ccd6b4.akpm@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=isdn4linux@listserv.isdn4linux.de \
--cc=kai.germaschewski@gmx.de \
--cc=kkeil@suse.de \
--cc=linux-kernel@vger.kernel.org \
--cc=matthias.kaehlcke@gmail.com \
/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