]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commit
lib: logic_pio: Fix RCU usage
authorJohn Garry <john.garry@huawei.com>
Tue, 30 Jul 2019 13:29:52 +0000 (21:29 +0800)
committerKhalid Elmously <khalid.elmously@canonical.com>
Thu, 26 Sep 2019 04:34:52 +0000 (00:34 -0400)
commitbf17c3ff17539b57fb7ff0489eee69c8dd3b7a26
tree325ce64dd40e4d58e204b388e70b449506afbeec
parent8fa1c78bdac253bed5b09752604d47651898f9f3
lib: logic_pio: Fix RCU usage

BugLink: https://bugs.launchpad.net/bugs/1843338
commit 06709e81c668f5f56c65b806895b278517bd44e0 upstream.

The traversing of io_range_list with list_for_each_entry_rcu()
is not properly protected by rcu_read_lock() and rcu_read_unlock(),
so add them.

These functions mark the critical section scope where the list is
protected for the reader, it cannot be  "reclaimed". Any updater - in
this case, the logical PIO registration functions - cannot update the
list until the reader exits this critical section.

In addition, the list traversing used in logic_pio_register_range()
does not need to use the rcu variant.

This is because we are already using io_range_mutex to guarantee mutual
exclusion from mutating the list.

Cc: stable@vger.kernel.org
Fixes: 031e3601869c ("lib: Add generic PIO mapping method")
Signed-off-by: John Garry <john.garry@huawei.com>
Signed-off-by: Wei Xu <xuwei5@hisilicon.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
lib/logic_pio.c