Received: by 10.223.185.116 with SMTP id b49csp6422972wrg; Wed, 28 Feb 2018 09:08:57 -0800 (PST) X-Google-Smtp-Source: AH8x224azCuuex90jMleie7udmihFX72F064H/BzPV/xlkTdPE0M1MLLeu0abi5uV92OYG/1zytf X-Received: by 10.99.137.195 with SMTP id v186mr14677337pgd.90.1519837737085; Wed, 28 Feb 2018 09:08:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519837737; cv=none; d=google.com; s=arc-20160816; b=C/5w7nFxSkvXDEr/XgyukRvxSwLdeJY8o+I+z1zkZHiYuKIL5V1TS9bf6DBs2Jt/45 z1IYQDI5r1gwiYfqK7TqUb2wA3BK1iPXLRqszbKJJQr8IDxtFgNNZfGApD0Gvh2f0MP2 h7uAcqiZdQ+EkBnQwH2BNcfcnrzJDc59iQHUnkKepn80VxzGZtT3EsMXBykwI2ehNmu4 Dqmh2v2x9uKBiDrYRE1ZSdkJFcG7d7w6RGK3VApbBfaNvTc3TZITvps7S1aCBuaBLowa bVEv/vBDSofFPFArasLKkSn3leQBZxwD4F+lGubsOoSHOH8T8EiqE6fkIKVxAESYLgQw LIog== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:subject:message-id:date:cc:to :from:mime-version:content-transfer-encoding:content-disposition :arc-authentication-results; bh=JyqsWcN1PQ6A4ZanHONxfCQKf7IRghs/aR2j6oMu238=; b=apt2Tca097h6jn9cNLEbi+iqR2vyXKEabNDsZF13TvDt+KbbPcvr6yvwl9x7fA/WTB rdkA+kDYDzUahlXq2pk+gqi3vBCIsS1fKJVZ1RrDk1lGsbH2+8kZNyPqSu9vQPZljXeY Y3ylxfq0+nQHs1HTqdBRjO/8ud9cv6zsztT30mKDSq67Nnccm7vu5q5og5+O/Cn3BlgU 4Ip0JiNDzXCtkeyLCn9huTorpM3Svd75VqozHYnkzjTM8G5u5DRqeP+8VxwcrMU4MC5U y81pU8kyTPZ1M6IPcb+eApQFIeVUNeCpOtQOV3Tg0X9KRStm/IRUhoHqLUKg3w3PaGEJ NnaQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 3-v6si1516663plr.440.2018.02.28.09.08.41; Wed, 28 Feb 2018 09:08:57 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932958AbeB1RHe (ORCPT + 99 others); Wed, 28 Feb 2018 12:07:34 -0500 Received: from shadbolt.e.decadent.org.uk ([88.96.1.126]:34310 "EHLO shadbolt.e.decadent.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933212AbeB1PuN (ORCPT ); Wed, 28 Feb 2018 10:50:13 -0500 Received: from [2a02:8011:400e:2:6f00:88c8:c921:d332] (helo=deadeye) by shadbolt.decadent.org.uk with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1er3Yv-0006Xm-G9; Wed, 28 Feb 2018 15:22:33 +0000 Received: from ben by deadeye with local (Exim 4.90_1) (envelope-from ) id 1er3Yd-0008NG-BP; Wed, 28 Feb 2018 15:22:15 +0000 Content-Type: text/plain; charset="UTF-8" Content-Disposition: inline Content-Transfer-Encoding: 8bit MIME-Version: 1.0 From: Ben Hutchings To: linux-kernel@vger.kernel.org, stable@vger.kernel.org CC: akpm@linux-foundation.org, "Jens Axboe" Date: Wed, 28 Feb 2018 15:20:18 +0000 Message-ID: X-Mailer: LinuxStableQueue (scripts by bwh) Subject: [PATCH 3.16 016/254] blktrace: fix trace mutex deadlock In-Reply-To: X-SA-Exim-Connect-IP: 2a02:8011:400e:2:6f00:88c8:c921:d332 X-SA-Exim-Mail-From: ben@decadent.org.uk X-SA-Exim-Scanned: No (on shadbolt.decadent.org.uk); SAEximRunCond expanded to false Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 3.16.55-rc1 review patch. If anyone has any objections, please let me know. ------------------ From: Jens Axboe commit 2967acbb257a6a9bf912f4778b727e00972eac9b upstream. 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 Signed-off-by: Ben Hutchings --- kernel/trace/blktrace.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/kernel/trace/blktrace.c +++ b/kernel/trace/blktrace.c @@ -562,7 +562,7 @@ static int __blk_trace_setup(struct requ return ret; if (copy_to_user(arg, &buts, sizeof(buts))) { - blk_trace_remove(q); + __blk_trace_remove(q); return -EFAULT; } return 0; @@ -608,7 +608,7 @@ static int compat_blk_trace_setup(struct return ret; if (copy_to_user(arg, &buts.name, ARRAY_SIZE(buts.name))) { - blk_trace_remove(q); + __blk_trace_remove(q); return -EFAULT; }