]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/commit
s390/cio: dont call css_wait_for_slow_path() inside a lock
authorVineeth Vijayan <vneethv@linux.ibm.com>
Wed, 9 Jun 2021 07:21:08 +0000 (09:21 +0200)
committerStefan Bader <stefan.bader@canonical.com>
Fri, 13 Aug 2021 07:29:47 +0000 (09:29 +0200)
commit593031b06ae26bcf49a85d915e06c708e6b584f0
tree1e4b994c3f2cea30340a7ca23dc1accfe82dfbea
parent3f9483f98289530612abba870de942c1f96d402c
s390/cio: dont call css_wait_for_slow_path() inside a lock

BugLink: https://bugs.launchpad.net/bugs/1938340
commit c749d8c018daf5fba6dfac7b6c5c78b27efd7d65 upstream.

Currently css_wait_for_slow_path() gets called inside the chp->lock.
The path-verification-loop of slowpath inside this lock could lead to
deadlock as reported by the lockdep validator.

The ccw_device_get_chp_desc() during the instance of a device-set-online
would try to acquire the same 'chp->lock' to read the chp->desc.
The instance of this function can get called from multiple scenario,
like probing or setting-device online manually. This could, in some
corner-cases lead to the deadlock.

lockdep validator reported this as,

        CPU0                    CPU1
        ----                    ----
   lock(&chp->lock);
                                lock(kn->active#43);
                                lock(&chp->lock);
   lock((wq_completion)cio);

The chp->lock was introduced to serialize the access of struct
channel_path. This lock is not needed for the css_wait_for_slow_path()
function, so invoke the slow-path function outside this lock.

Fixes: b730f3a93395 ("[S390] cio: add lock to struct channel_path")
Cc: <stable@vger.kernel.org>
Reviewed-by: Peter Oberparleiter <oberpar@linux.ibm.com>
Signed-off-by: Vineeth Vijayan <vneethv@linux.ibm.com>
Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
drivers/s390/cio/chp.c
drivers/s390/cio/chsc.c