Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp2345809imm; Thu, 7 Jun 2018 09:07:14 -0700 (PDT) X-Google-Smtp-Source: ADUXVKLciZ5jVWriwCFRN6gWYctqiPJdTkhAYRY995i3iTZd/NfuBUavycTr9X6iuQHLFLSZ7k+U X-Received: by 2002:a62:d97:: with SMTP id 23-v6mr2357500pfn.202.1528387634236; Thu, 07 Jun 2018 09:07:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528387634; cv=none; d=google.com; s=arc-20160816; b=znBycHOX0BObOI+E+poHN1vfdyw4gP5vbIrcgGmHkkNB0hdKaQY1S/qS8kqBdu5qi2 o5pnjQ6bo3R4NIZvSrQjBSEJLtCNkzeKjpb780Ufz6h33/EXeCw1M6572YOsvj26ViX+ RAIZCr3FkC+3i2gq1+MqFtBFuGGTtSc2JbeLIWBfZ23iswWEnHHl48P0V4jUCGJ1V+of 36sRdQlMeagWzLNhKZyD2ulxHP2YMY5rxJfhQGWh/6tuaH5RLG++ZgZ71DOrCLlk7cJx bxfuIn8D/ZM5qeWWP8sM500quaClhdx1wGd1VgG6BMIM06r6IKodlSrx8AhfuFqPIsVz GqCQ== 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=RGPxyWZcBE8o/YrQieQf+/AZBrLPAAKjzwmGk0AlRnU=; b=PDBUVtB1iRl455OrajSlK9DbFnYU2UHynkl9ycWHdPIWHG68SImvfYPc3Bl169ZmG4 W1W2EHZJD9xPn1TZBQP8gA9PZCJMIFejfxh4NcCbUG7Q0ONW7+2apSllge/GaQjDf7fd Yu3cwjCrGslfFCdLZJdO5a6XlORbDEIh0BgPF6ku1BkZ2T1ky5OSR2sgEUYYXMHr/vS7 4QuUyz+Hz5AtZ3Q9WMVnvphieKar/KbATjs/ZfDUOByHeKwzpKUa2rp5hxU3iiLpMM6x dtEGLIFpnS0nYPVLPudZM3tDDt5QQAc54Y+65pnW7NHVD+xqx6KKGvxoovMsNPCBJxVc yp8w== 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 w3-v6si16090503pgc.645.2018.06.07.09.06.59; Thu, 07 Jun 2018 09:07:14 -0700 (PDT) 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 S934228AbeFGQDz (ORCPT + 99 others); Thu, 7 Jun 2018 12:03:55 -0400 Received: from shadbolt.e.decadent.org.uk ([88.96.1.126]:39265 "EHLO shadbolt.e.decadent.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933022AbeFGOJE (ORCPT ); Thu, 7 Jun 2018 10:09:04 -0400 Received: from [148.252.241.226] (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 1fQvb4-0005Zt-80; Thu, 07 Jun 2018 15:09:02 +0100 Received: from ben by deadeye with local (Exim 4.91) (envelope-from ) id 1fQvb1-0002ot-67; Thu, 07 Jun 2018 15:08:59 +0100 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" , "Maciej S. Szmigiero" , "Tejun Heo" , "Bart Van Assche" Date: Thu, 07 Jun 2018 15:05:21 +0100 Message-ID: X-Mailer: LinuxStableQueue (scripts by bwh) Subject: [PATCH 3.16 095/410] pktcdvd: Fix pkt_setup_dev() error path In-Reply-To: X-SA-Exim-Connect-IP: 148.252.241.226 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.57-rc1 review patch. If anyone has any objections, please let me know. ------------------ From: Bart Van Assche commit 5a0ec388ef0f6e33841aeb810d7fa23f049ec4cd upstream. Commit 523e1d399ce0 ("block: make gendisk hold a reference to its queue") modified add_disk() and disk_release() but did not update any of the error paths that trigger a put_disk() call after disk->queue has been assigned. That introduced the following behavior in the pktcdvd driver if pkt_new_dev() fails: Kernel BUG at 00000000e98fd882 [verbose debug info unavailable] Since disk_release() calls blk_put_queue() anyway if disk->queue != NULL, fix this by removing the blk_cleanup_queue() call from the pkt_setup_dev() error path. Fixes: commit 523e1d399ce0 ("block: make gendisk hold a reference to its queue") Signed-off-by: Bart Van Assche Cc: Tejun Heo Cc: Maciej S. Szmigiero Signed-off-by: Jens Axboe Signed-off-by: Ben Hutchings --- drivers/block/pktcdvd.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) --- a/drivers/block/pktcdvd.c +++ b/drivers/block/pktcdvd.c @@ -2796,7 +2796,7 @@ static int pkt_setup_dev(dev_t dev, dev_ pd->pkt_dev = MKDEV(pktdev_major, idx); ret = pkt_new_dev(pd, dev); if (ret) - goto out_new_dev; + goto out_mem2; /* inherit events of the host device */ disk->events = pd->bdev->bd_disk->events; @@ -2814,8 +2814,6 @@ static int pkt_setup_dev(dev_t dev, dev_ mutex_unlock(&ctl_mutex); return 0; -out_new_dev: - blk_cleanup_queue(disk->queue); out_mem2: put_disk(disk); out_mem: