mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-09 21:59:12 -04:00
mm: swap: Add null pointer check
Address an unlikely null pointer dereference.
Fixes commit 7b5df13bc4b3 ("mm: swap: free up swap on mm reap").
The expected usage of free_swap_slot is that the caller has already
checked that the swap_entry_t is valid.
Change-Id: I85331f817458df7f6cb0c0b387ca34c345f8c513
Signed-off-by: Patrick Daly <pdaly@codeaurora.org>
Signed-off-by: Isaac J. Manjarres <isaacm@codeaurora.org>
This commit is contained in:
parent
bd9e19a39a
commit
3890a7b5fd
1 changed files with 1 additions and 1 deletions
|
|
@ -282,7 +282,7 @@ int free_swap_slot(swp_entry_t entry)
|
|||
|
||||
si = swp_swap_info(entry);
|
||||
cache = raw_cpu_ptr(&swp_slots);
|
||||
if (!(si->flags & SWP_SYNCHRONOUS_IO) &&
|
||||
if ((si && !(si->flags & SWP_SYNCHRONOUS_IO)) &&
|
||||
use_swap_slot_cache && cache->slots_ret) {
|
||||
spin_lock_irq(&cache->free_lock);
|
||||
/* Swap slots cache may be deactivated before acquiring lock */
|
||||
|
|
|
|||
Loading…
Reference in a new issue