From patchwork Tue Jan 2 19:39:47 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 10141267 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id B01836035E for ; Tue, 2 Jan 2018 19:40:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9EA8C28DEA for ; Tue, 2 Jan 2018 19:40:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9143B28E06; Tue, 2 Jan 2018 19:40:15 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DDA6728DEA for ; Tue, 2 Jan 2018 19:40:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751381AbeABTkN (ORCPT ); Tue, 2 Jan 2018 14:40:13 -0500 Received: from esa6.hgst.iphmx.com ([216.71.154.45]:18571 "EHLO esa6.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751127AbeABTkN (ORCPT ); Tue, 2 Jan 2018 14:40:13 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1514922013; x=1546458013; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=ZxG+oKoGdEQu8p2bpgim1/omngQghvBLzMy0EKaWzQA=; b=kiSFglB4ik+l7g/EtjRrYFbV9pJdoVCTjcC2jrDS1bSkOnEB1t6z5i33 RpT6E0vz4bX6cUbUKzfQiYa9gGn0QO6dHiXUf2Lm1Z4xRQ/BVOrBglcne nwgB1F3F/8oKzIejXkkElQNMm00OIQrwxzd1LhU0LVxgcbWH16JWCnX+z tbTqvKIe0L5lBA4nxKYUH5w9x71klUdSstURGW7D0cJrnqw8zbAyLH+JX NKZz1aeR9JR9F1OOM2Kw3Yw9awKuxO64tfxmI4qxsbGC94vAk6751MY4p Y3VGICCko1TGpbFmMwqK4VKejvHH1u1SGUZ4zUpVM//SdJA0e2Xl985zk w==; X-IronPort-AV: E=Sophos;i="5.45,498,1508774400"; d="scan'208";a="67991986" Received: from h199-255-45-15.hgst.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 03 Jan 2018 03:40:12 +0800 Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep02.wdc.com with ESMTP; 02 Jan 2018 11:36:00 -0800 Received: from thinkpad-bart.sdcorp.global.sandisk.com (HELO thinkpad-bart.int.fusionio.com) ([10.11.171.236]) by uls-op-cesaip02.wdc.com with ESMTP; 02 Jan 2018 11:40:09 -0800 From: Bart Van Assche To: Jens Axboe Cc: linux-block@vger.kernel.org, Christoph Hellwig , Bart Van Assche , Tejun Heo , "Maciej S . Szmigiero" , stable@vger.kernel.org Subject: [PATCH 1/2] pktcdvd: Fix pkt_setup_dev() error path Date: Tue, 2 Jan 2018 11:39:47 -0800 Message-Id: <20180102193948.22656-2-bart.vanassche@wdc.com> X-Mailer: git-send-email 2.15.1 In-Reply-To: <20180102193948.22656-1-bart.vanassche@wdc.com> References: <20180102193948.22656-1-bart.vanassche@wdc.com> Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 Cc: # v3.2 --- drivers/block/pktcdvd.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/block/pktcdvd.c b/drivers/block/pktcdvd.c index 67974796c350..2659b2534073 100644 --- a/drivers/block/pktcdvd.c +++ b/drivers/block/pktcdvd.c @@ -2745,7 +2745,7 @@ static int pkt_setup_dev(dev_t dev, dev_t* pkt_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; @@ -2763,8 +2763,6 @@ static int pkt_setup_dev(dev_t dev, dev_t* pkt_dev) mutex_unlock(&ctl_mutex); return 0; -out_new_dev: - blk_cleanup_queue(disk->queue); out_mem2: put_disk(disk); out_mem: