Skip to content
Commit b56eca6b authored by Francesco Ruggeri's avatar Francesco Ruggeri Committed by Paul Gortmaker
Browse files

ACPI: OSL: only free map once in osl.c

commit 833a426c upstream.

acpi_os_map_cleanup checks map->refcount outside of acpi_ioremap_lock
before freeing the map. This creates a race condition the can result
in the map being freed more than once.
A panic can be caused by running

for ((i=0; i<10; i++))
do
        for ((j=0; j<100000; j++))
        do
                cat /sys/firmware/acpi/tables/data/BERT >/dev/null
        done &
done

This patch makes sure that only the process that drops the reference
to 0 does the freeing.

Fixes: b7c1fadd

 ("ACPI: Do not use krefs under a mutex in osl.c")
Signed-off-by: default avatarFrancesco Ruggeri <fruggeri@arista.com>
Reviewed-by: default avatarDmitry Safonov <0x7f454c46@gmail.com>
Cc: All applicable <stable@vger.kernel.org>
Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: default avatarPaul Gortmaker <paul.gortmaker@windriver.com>
parent 2ba38c34
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