From: Max Asbock <masbock@us.ibm.com>
To: Greg KH <greg@kroah.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] ibmasm driver: don't use previously freed pointer
Date: Tue, 07 Feb 2006 09:29:17 -0800 [thread overview]
Message-ID: <1139333357.7521.81.camel@w-amax> (raw)
In-Reply-To: <20060204060254.GA4454@kroah.com>
On Fri, 2006-02-03 at 22:02, Greg KH wrote:
> On Fri, Feb 03, 2006 at 02:26:38PM -0800, Max Asbock wrote:
> > ibmasm driver:
> > Fix the command_put() function which uses a pointer for a spinlock that
> > can be freed before dereferencing it.
> >
> > Signed-off-by: Max Asbock masbock@us.ibm.com
> >
> > ---
> >
> > diff -burpN linux-2.6.16-rc1/drivers/misc/ibmasm/ibmasm.h linux-2.6.16-rc1.ibmasm/drivers/misc/ibmasm/ibmasm.h
> > --- linux-2.6.16-rc1/drivers/misc/ibmasm/ibmasm.h 2006-02-01 11:50:01.000000000 -0800
> > +++ linux-2.6.16-rc1.ibmasm/drivers/misc/ibmasm/ibmasm.h 2006-02-03 13:57:42.000000000 -0800
> > @@ -101,10 +101,11 @@ struct command {
> > static inline void command_put(struct command *cmd)
> > {
> > unsigned long flags;
> > + spinlock_t *lock = cmd->lock;
> >
> > - spin_lock_irqsave(cmd->lock, flags);
> > + spin_lock_irqsave(lock, flags);
> > kobject_put(&cmd->kobj);
> > - spin_unlock_irqrestore(cmd->lock, flags);
> > + spin_unlock_irqrestore(lock, flags);
> > }
>
> If this patch is true, doesn't the spinlock the pointer is pointing out
> still get deleted?
>
> Yes you save a pointer off, but it looks like the problem is still
> present.
>
> Or am I missing something?
>
The lock pointer in struct command points to a spinlock outside the
structure that doesn't get deleted.
max
next prev parent reply other threads:[~2006-02-07 17:29 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-02-03 22:26 Max Asbock
2006-02-04 6:02 ` Greg KH
2006-02-07 17:29 ` Max Asbock [this message]
2006-02-07 17:44 ` Greg KH
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=1139333357.7521.81.camel@w-amax \
--to=masbock@us.ibm.com \
--cc=greg@kroah.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®