Skip to content
Commit f7d594d0 authored by Roland Kammerer's avatar Roland Kammerer Committed by Greg Kroah-Hartman
Browse files

drbd: narrow rcu_read_lock in drbd_sync_handshake



[ Upstream commit d29e89e3 ]

So far there was the possibility that we called
genlmsg_new(GFP_NOIO)/mutex_lock() while holding an rcu_read_lock().

This included cases like:

drbd_sync_handshake (acquire the RCU lock)
  drbd_asb_recover_1p
    drbd_khelper
      drbd_bcast_event
        genlmsg_new(GFP_NOIO) --> may sleep

drbd_sync_handshake (acquire the RCU lock)
  drbd_asb_recover_1p
    drbd_khelper
      notify_helper
        genlmsg_new(GFP_NOIO) --> may sleep

drbd_sync_handshake (acquire the RCU lock)
  drbd_asb_recover_1p
    drbd_khelper
      notify_helper
        mutex_lock --> may sleep

While using GFP_ATOMIC whould have been possible in the first two cases,
the real fix is to narrow the rcu_read_lock.

Reported-by: default avatarJia-Ju Bai <baijiaju1990@163.com>
Reviewed-by: default avatarLars Ellenberg <lars.ellenberg@linbit.com>
Signed-off-by: default avatarRoland Kammerer <roland.kammerer@linbit.com>
Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent f8a8291e
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment