]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
md: md.c: fix oops in mddev_suspend for raid0
authorHeinz Mauelshagen <heinzm@redhat.com>
Tue, 3 May 2016 17:43:57 +0000 (19:43 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 1 Jun 2016 19:18:04 +0000 (12:18 -0700)
commit 092398dce8c2406bfb0c9eebc3e764ff2ddb62a8 upstream.

Introduced by upstream commit 70d9798b95562abac005d4ba71d28820f9a201eb

The raid0 personality does not create mddev->thread as oposed to
other personalities leading to its unconditional access in
mddev_suspend() causing an oops.

Patch checks for mddev->thread in order to keep the
intention of aforementioned commit.

Fixes: 70d9798b9556 ("MD: warn for potential deadlock")
Signed-off-by: Heinz Mauelshagen <heinzm@redhat.com>
Signed-off-by: Shaohua Li <shli@fb.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/md/md.c

index 14d3b37944df031214c2c6951ed15c46da104842..85b16aadd459b49ea37dec4c8e82f5b8003926bf 100644 (file)
@@ -307,7 +307,7 @@ static blk_qc_t md_make_request(struct request_queue *q, struct bio *bio)
  */
 void mddev_suspend(struct mddev *mddev)
 {
-       WARN_ON_ONCE(current == mddev->thread->tsk);
+       WARN_ON_ONCE(mddev->thread && current == mddev->thread->tsk);
        if (mddev->suspended++)
                return;
        synchronize_rcu();