All of lore.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <greg@kroah.com>
To: DONG-DONG YANG <gdb746@motorola.com>
Cc: linux-kernel <linux-kernel@vger.kernel.org>,
	Kroah-Hartman <gregkh@suse.de>, Yi-wei Zhao <gbjc64@motorola.com>,
	TAO HU <taohu@motorola.com>, David Ding <dding@motorola.com>,
	Jeffrey Carlyle <jeff.carlyle@motorola.com>,
	zhiming YUAN <a14194@motorola.com>
Subject: Re: [PATCH 1/1] firmware_loading_store: fix firmware loading use-after-free oops
Date: Fri, 9 Dec 2011 15:57:32 -0800	[thread overview]
Message-ID: <20111209235732.GB6680@kroah.com> (raw)
In-Reply-To: <CACo43CLUiVxLof1k+Z4zL8B+mg9Giob6NhMeZn8WWGSqMc97wg@mail.gmail.com>

On Thu, Dec 01, 2011 at 05:26:10PM +0800, DONG-DONG YANG wrote:
> 
> firmware_loading_store() should check for fw_priv->fw before fw_load_abort.
> Otherwise, the system has a chance to run into use-after-free oops,
> if the user-space handler sends "-1" to firmware controller(loading) in
> exception scenarios before sending "1" to start a load.
> See the attachment for the kernel log and the analysis
> 
> Tested:
>   ARM_ca9 + android init uevent + webtop udev
> 
> Patch:
> diff --git a/drivers/base/firmware_class.c b/drivers/base/firmware_class.c
> index 06ed6b4..b333082 100644
> --- a/drivers/base/firmware_class.c
> +++ b/drivers/base/firmware_class.c
> @@ -271,7 +271,8 @@ static ssize_t firmware_loading_store(struct device *dev,
>                 /* fallthrough */
>         case -1:
>         err:
> -               fw_load_abort(fw_priv);
> +               if (fw_priv->fw)
> +                       fw_load_abort(fw_priv);
>                 break;
>         }
> 

Can you resend this in the format described in
Documentation/SubmittingPatches so that I can accept it?  (hint, you
forgot the signed-off-by: line.)

Also, shouldn't we do the check for ->fw in the fw_load_abort() call?

And why is userspace doing wierd things like this?  What causes that?

thanks,

greg k-h

       reply	other threads:[~2011-12-10  0:03 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CACo43CLUiVxLof1k+Z4zL8B+mg9Giob6NhMeZn8WWGSqMc97wg@mail.gmail.com>
2011-12-09 23:57 ` Greg KH [this message]
     [not found]   ` <CACo43CKhoqvskCrqFfg9mo17OpegnSr84V3ZHEwSrCmp=ZmLcA@mail.gmail.com>
2011-12-13 17:31     ` [PATCH 1/1] firmware_loading_store: fix firmware loading use-after-free oops 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=20111209235732.GB6680@kroah.com \
    --to=greg@kroah.com \
    --cc=a14194@motorola.com \
    --cc=dding@motorola.com \
    --cc=gbjc64@motorola.com \
    --cc=gdb746@motorola.com \
    --cc=gregkh@suse.de \
    --cc=jeff.carlyle@motorola.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=taohu@motorola.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.