]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commit
srcu: Lock srcu_data structure in srcu_gp_start()
authorDennis Krein <Dennis.Krein@netapp.com>
Thu, 28 Feb 2019 13:49:41 +0000 (10:49 -0300)
committerKhalid Elmously <khalid.elmously@canonical.com>
Thu, 28 Feb 2019 17:39:35 +0000 (12:39 -0500)
commitfb837273a1f17ba249baf8fdf97a0ce0735b870a
tree8d19d0b32ac4e82fe4c6560011762eede011cb3f
parenta65797d0b04e5fc354fece2c5aaa9980f129c54d
srcu: Lock srcu_data structure in srcu_gp_start()

BugLink: http://bugs.launchpad.net/bugs/1802021
The srcu_gp_start() function is called with the srcu_struct structure's
->lock held, but not with the srcu_data structure's ->lock.  This is
problematic because this function accesses and updates the srcu_data
structure's ->srcu_cblist, which is protected by that lock.  Failing to
hold this lock can result in corruption of the SRCU callback lists,
which in turn can result in arbitrarily bad results.

This commit therefore makes srcu_gp_start() acquire the srcu_data
structure's ->lock across the calls to rcu_segcblist_advance() and
rcu_segcblist_accelerate(), thus preventing this corruption.

Reported-by: Bart Van Assche <bvanassche@acm.org>
Reported-by: Christoph Hellwig <hch@infradead.org>
Reported-by: Sebastian Kuzminsky <seb.kuzminsky@gmail.com>
Signed-off-by: Dennis Krein <Dennis.Krein@netapp.com>
Signed-off-by: Paul E. McKenney <paulmck@linux.ibm.com>
Tested-by: Dennis Krein <Dennis.Krein@netapp.com>
Cc: <stable@vger.kernel.org> # 4.16.x
(cherry picked from commit eb4c2382272ae7ae5d81fdfa5b7a6c86146eaaa4)
Signed-off-by: Marcelo Henrique Cerri <marcelo.cerri@canonical.com>
Acked-by: Stefan Bader <stefan.bader@canonical.com>
Acked-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
kernel/rcu/srcutree.c