public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <greg@kroah.com>
To: Max Asbock <masbock@us.ibm.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] ibmasm driver: don't use previously freed pointer
Date: Fri, 3 Feb 2006 22:02:54 -0800	[thread overview]
Message-ID: <20060204060254.GA4454@kroah.com> (raw)
In-Reply-To: <1139005598.7521.68.camel@w-amax>

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

  reply	other threads:[~2006-02-04  6:03 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-02-03 22:26 [PATCH] ibmasm driver: don't use previously freed pointer Max Asbock
2006-02-04  6:02 ` Greg KH [this message]
2006-02-07 17:29   ` Max Asbock
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=20060204060254.GA4454@kroah.com \
    --to=greg@kroah.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=masbock@us.ibm.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