mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Stuart Hayes <stuart.w.hayes@gmail.com>
To: Christoph Hellwig <hch@lst.de>, dvhart@infradead.org, andy@infradead.org
Cc: platform-driver-x86@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	Dan Carpenter <dan.carpenter@oracle.com>
Subject: Re: [PATCH] platform/x86: dell_rbu: fix lock imbalance in img_update_realloc
Date: Tue, 12 Feb 2019 21:56:30 -0600	[thread overview]
Message-ID: <8d8a1ad0-2192-5293-9073-21d1916778ff@gmail.com> (raw)
In-Reply-To: <20190211130940.28206-1-hch@lst.de>



On 2/11/2019 7:09 AM, Christoph Hellwig wrote:
> We need to ensure rbu_data.lock is always held on return.
> 
> Fixes: 289790a3ea94 ("platform/x86: dell_rbu: stop abusing the DMA API")
> Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
>  drivers/platform/x86/dell_rbu.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/platform/x86/dell_rbu.c b/drivers/platform/x86/dell_rbu.c
> index 8104ca0c44ca..031c68903583 100644
> --- a/drivers/platform/x86/dell_rbu.c
> +++ b/drivers/platform/x86/dell_rbu.c
> @@ -436,6 +436,7 @@ static int img_update_realloc(unsigned long size)
>  	ordernum = get_order(size);
>  	image_update_buffer =
>  		(unsigned char *)__get_free_pages(GFP_DMA32, ordernum);
> +	spin_lock(&rbu_data.lock);
>  	if (!image_update_buffer) {
>  		pr_debug("Not enough memory for image update:"
>  			"size = %ld\n", size);
> @@ -446,7 +447,6 @@ static int img_update_realloc(unsigned long size)
>  	if (WARN_ON_ONCE(img_buf_phys_addr > BIOS_SCAN_LIMIT))
>  		return -EINVAL; /* can't happen per definition */
>  
> -	spin_lock(&rbu_data.lock);
>  	rbu_data.image_update_buffer = image_update_buffer;
>  	rbu_data.image_update_buffer_size = size;
>  	rbu_data.bios_image_size = rbu_data.image_update_buffer_size;
> 

Acked-by: Stuart Hayes <stuart.w.hayes@gmail.com>

  reply	other threads:[~2019-02-13  3:56 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-11 13:09 Christoph Hellwig
2019-02-13  3:56 ` Stuart Hayes [this message]
2019-02-15 19:57   ` Andy Shevchenko

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=8d8a1ad0-2192-5293-9073-21d1916778ff@gmail.com \
    --to=stuart.w.hayes@gmail.com \
    --cc=andy@infradead.org \
    --cc=dan.carpenter@oracle.com \
    --cc=dvhart@infradead.org \
    --cc=hch@lst.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=platform-driver-x86@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®