mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jesse Barnes <jbarnes@virtuousgeek.org>
To: Jiri Slaby <jirislaby@gmail.com>
Cc: linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org,
	Kristen Carlson Accardi <kristen.c.accardi@intel.com>,
	Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com>
Subject: Re: [PATCH] PCI: pciehp_core, fix lock imbalance
Date: Mon, 19 Jan 2009 10:56:36 -0800	[thread overview]
Message-ID: <200901191056.36992.jbarnes@virtuousgeek.org> (raw)
In-Reply-To: <1232205835-21854-1-git-send-email-jirislaby@gmail.com>

On Saturday, January 17, 2009 7:23 am Jiri Slaby wrote:
> set_lock_status omits mutex_unlock in fail path. Add the omitted
> unlock.
>
> As a result a lockup caused by this can be triggered from userspace
> by writing 1 to /sys/bus/pci/slots/.../lock often enough.
>
> Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
> Cc: Kristen Carlson Accardi <kristen.c.accardi@intel.com>
> Cc: Jesse Barnes <jbarnes@virtuousgeek.org>
> ---
>  drivers/pci/hotplug/pciehp_core.c |    4 +++-
>  1 files changed, 3 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/pci/hotplug/pciehp_core.c
> b/drivers/pci/hotplug/pciehp_core.c index 5482d4e..c248554 100644
> --- a/drivers/pci/hotplug/pciehp_core.c
> +++ b/drivers/pci/hotplug/pciehp_core.c
> @@ -126,8 +126,10 @@ static int set_lock_status(struct hotplug_slot
> *hotplug_slot, u8 status) mutex_lock(&slot->ctrl->crit_sect);
>
>  	/* has it been >1 sec since our last toggle? */
> -	if ((get_seconds() - slot->last_emi_toggle) < 1)
> +	if ((get_seconds() - slot->last_emi_toggle) < 1) {
> +		mutex_unlock(&slot->ctrl->crit_sect);
>  		return -EINVAL;
> +	}
>
>  	/* see what our current state is */
>  	retval = get_lock_status(hotplug_slot, &value);

Applied to my for-linus branch (with Kenji-san's reviewed-by), thanks.

-- 
Jesse Barnes, Intel Open Source Technology Center

      parent reply	other threads:[~2009-01-19 18:56 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-17 15:23 Jiri Slaby
2009-01-19  2:01 ` Kenji Kaneshige
2009-01-19 18:56 ` Jesse Barnes [this message]

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=200901191056.36992.jbarnes@virtuousgeek.org \
    --to=jbarnes@virtuousgeek.org \
    --cc=jirislaby@gmail.com \
    --cc=kaneshige.kenji@jp.fujitsu.com \
    --cc=kristen.c.accardi@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@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

Powered by JetHome