summaryrefslogtreecommitdiff
path: root/drivers/platform
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2019-02-11 16:09:40 +0300
committerDarren Hart (VMware) <dvhart@infradead.org>2019-02-23 20:20:56 +0300
commitf27e1d1826d0392c0841e6f098b88e2da166163a (patch)
tree28216a2ad5c1889a5ffd4f4e4a92c7405c8eb3a5 /drivers/platform
parentb75318597391f22421809b0749ccb8aba80140c2 (diff)
downloadlinux-f27e1d1826d0392c0841e6f098b88e2da166163a.tar.xz
platform/x86: dell_rbu: fix lock imbalance in img_update_realloc
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> Acked-by: Stuart Hayes <stuart.w.hayes@gmail.com> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Darren Hart (VMware) <dvhart@infradead.org>
Diffstat (limited to 'drivers/platform')
-rw-r--r--drivers/platform/x86/dell_rbu.c2
1 files changed, 1 insertions, 1 deletions
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;