* [PATCH] ibmasm driver: don't use previously freed pointer
@ 2006-02-03 22:26 Max Asbock
2006-02-04 6:02 ` Greg KH
0 siblings, 1 reply; 4+ messages in thread
From: Max Asbock @ 2006-02-03 22:26 UTC (permalink / raw)
To: linux-kernel
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);
}
static inline void command_get(struct command *cmd)
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] ibmasm driver: don't use previously freed pointer
2006-02-03 22:26 [PATCH] ibmasm driver: don't use previously freed pointer Max Asbock
@ 2006-02-04 6:02 ` Greg KH
2006-02-07 17:29 ` Max Asbock
0 siblings, 1 reply; 4+ messages in thread
From: Greg KH @ 2006-02-04 6:02 UTC (permalink / raw)
To: Max Asbock; +Cc: linux-kernel
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?
thanks,
greg k-h
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] ibmasm driver: don't use previously freed pointer
2006-02-04 6:02 ` Greg KH
@ 2006-02-07 17:29 ` Max Asbock
2006-02-07 17:44 ` Greg KH
0 siblings, 1 reply; 4+ messages in thread
From: Max Asbock @ 2006-02-07 17:29 UTC (permalink / raw)
To: Greg KH; +Cc: linux-kernel
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
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] ibmasm driver: don't use previously freed pointer
2006-02-07 17:29 ` Max Asbock
@ 2006-02-07 17:44 ` Greg KH
0 siblings, 0 replies; 4+ messages in thread
From: Greg KH @ 2006-02-07 17:44 UTC (permalink / raw)
To: Max Asbock; +Cc: linux-kernel
On Tue, Feb 07, 2006 at 09:29:17AM -0800, Max Asbock wrote:
> 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.
Ok, that's what I was missing, nevermind then :)
thanks,
greg k-h
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2006-02-07 17:43 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-02-03 22:26 [PATCH] ibmasm driver: don't use previously freed pointer Max Asbock
2006-02-04 6:02 ` Greg KH
2006-02-07 17:29 ` Max Asbock
2006-02-07 17:44 ` Greg KH
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).