]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
blktrace: fix trace mutex deadlock
authorJens Axboe <axboe@kernel.dk>
Sun, 19 Nov 2017 18:52:55 +0000 (11:52 -0700)
committerJens Axboe <axboe@kernel.dk>
Mon, 27 Nov 2017 19:03:58 +0000 (12:03 -0700)
A previous commit changed the locking around registration/cleanup,
but direct callers of blk_trace_remove() were missed. This means
that if we hit the error path in setup, we will deadlock on
attempting to re-acquire the queue trace mutex.

Fixes: 1f2cac107c59 ("blktrace: fix unlocked access to init/start-stop/teardown")
Signed-off-by: Jens Axboe <axboe@kernel.dk>
kernel/trace/blktrace.c

index c5987d4c5f23b9fb45738c804964b974e7657268..987d9a9ae2839a2daefdd5c2d24ffe9c6d440bde 100644 (file)
@@ -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;
        }