Commit f27e1d18 authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Darren Hart (VMware)

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: default avatarDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Acked-by: default avatarStuart Hayes <stuart.w.hayes@gmail.com>
Signed-off-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: default avatarDarren Hart (VMware) <dvhart@infradead.org>
parent b7531859
...@@ -436,6 +436,7 @@ static int img_update_realloc(unsigned long size) ...@@ -436,6 +436,7 @@ static int img_update_realloc(unsigned long size)
ordernum = get_order(size); ordernum = get_order(size);
image_update_buffer = image_update_buffer =
(unsigned char *)__get_free_pages(GFP_DMA32, ordernum); (unsigned char *)__get_free_pages(GFP_DMA32, ordernum);
spin_lock(&rbu_data.lock);
if (!image_update_buffer) { if (!image_update_buffer) {
pr_debug("Not enough memory for image update:" pr_debug("Not enough memory for image update:"
"size = %ld\n", size); "size = %ld\n", size);
...@@ -446,7 +447,6 @@ static int img_update_realloc(unsigned long size) ...@@ -446,7 +447,6 @@ static int img_update_realloc(unsigned long size)
if (WARN_ON_ONCE(img_buf_phys_addr > BIOS_SCAN_LIMIT)) if (WARN_ON_ONCE(img_buf_phys_addr > BIOS_SCAN_LIMIT))
return -EINVAL; /* can't happen per definition */ 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 = image_update_buffer;
rbu_data.image_update_buffer_size = size; rbu_data.image_update_buffer_size = size;
rbu_data.bios_image_size = rbu_data.image_update_buffer_size; rbu_data.bios_image_size = rbu_data.image_update_buffer_size;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment