mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jens Axboe <axboe@kernel.dk>
To: syzbot 
	<bot+583353673e394aa41e5fb68ddc8b8d9d5c8d576f@syzkaller.appspotmail.com>,
	linux-block@vger.kernel.org, linux-kernel@vger.kernel.org,
	mingo@redhat.com, rostedt@goodmis.org,
	syzkaller-bugs@googlegroups.com
Subject: Re: possible deadlock in blk_trace_remove
Date: Sun, 19 Nov 2017 11:50:20 -0700	[thread overview]
Message-ID: <4d09f529-7cf9-7267-7dcb-122ecc957e7d@kernel.dk> (raw)
In-Reply-To: <001a1141f8dc4440a9055e53896e@google.com>

On 11/19/2017 03:36 AM, syzbot wrote:
> Hello,
> 
> syzkaller hit the following crash on  
> d9e0e63d9a6f88440eb201e1491fcf730272c706
> git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/master
> compiler: gcc (GCC) 7.1.1 20170620
> .config is attached
> Raw console output is attached.
> 
> Unfortunately, I don't have any reproducer for this bug yet.> 
> 
> Use struct sctp_sack_info instead
> 
> ============================================
> WARNING: possible recursive locking detected
> 4.14.0-rc8-next-20171110+ #40 Not tainted
> --------------------------------------------
> syz-executor6/21462 is trying to acquire lock:
>   (&q->blk_trace_mutex){+.+.}, at: [<ffffffff81760261>]  
> blk_trace_remove+0x21/0x40 kernel/trace/blktrace.c:373
> 
> but task is already holding lock:
>   (&q->blk_trace_mutex){+.+.}, at: [<ffffffff81763b38>]  
> blk_trace_setup+0x38/0x70 kernel/trace/blktrace.c:606
> 
> other info that might help us debug this:
>   Possible unsafe locking scenario:
> 
>         CPU0
>         ----
>    lock(&q->blk_trace_mutex);
>    lock(&q->blk_trace_mutex);

The below should fix it.


diff --git a/kernel/trace/blktrace.c b/kernel/trace/blktrace.c
index 206e0e2ace53..f224985de5fa 100644
--- a/kernel/trace/blktrace.c
+++ b/kernel/trace/blktrace.c
@@ -591,7 +591,7 @@ static int __blk_trace_setup(struct request_queue *q, char *name, dev_t dev,
 		return ret;
 
 	if (copy_to_user(arg, &buts, sizeof(buts))) {
-		blk_trace_remove(q);
+		__blk_trace_remove(q);
 		return -EFAULT;
 	}
 	return 0;
@@ -637,7 +637,7 @@ static int compat_blk_trace_setup(struct request_queue *q, char *name,
 		return ret;
 
 	if (copy_to_user(arg, &buts.name, ARRAY_SIZE(buts.name))) {
-		blk_trace_remove(q);
+		__blk_trace_remove(q);
 		return -EFAULT;
 	}
 
 
-- 
Jens Axboe

       reply	other threads:[~2017-11-19 18:50 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <001a1141f8dc4440a9055e53896e@google.com>
2017-11-19 18:50 ` Jens Axboe [this message]
2017-12-03 20:24 ` Eric Biggers
2017-12-04  0:24   ` Jens Axboe
2017-12-04  0:44     ` Eric Biggers
2017-12-04  0:47       ` Jens Axboe
2017-12-04  3:47         ` Mike Galbraith

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4d09f529-7cf9-7267-7dcb-122ecc957e7d@kernel.dk \
    --to=axboe@kernel.dk \
    --cc=bot+583353673e394aa41e5fb68ddc8b8d9d5c8d576f@syzkaller.appspotmail.com \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=rostedt@goodmis.org \
    --cc=syzkaller-bugs@googlegroups.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome