Received: by 10.223.185.116 with SMTP id b49csp2202663wrg; Thu, 15 Feb 2018 08:03:09 -0800 (PST) X-Google-Smtp-Source: AH8x224fhnRfwFEBAhjSzt9p5gsfe6siFWtJJLHIBnge61qHLRX8buP/bUO/9bV/KKKjy4TExlkx X-Received: by 10.101.80.69 with SMTP id k5mr2519626pgo.439.1518710588940; Thu, 15 Feb 2018 08:03:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518710588; cv=none; d=google.com; s=arc-20160816; b=X2rmAWMHL4qA+7Po0WQC47iRKCeRI7zma9rY+273xwVuCqFmV31nZtgTus0fDJtgPt /9TybzKfiXUnc6vJvpEwO0jFgj9qTAhDgPNQxjsGGwm+SFtDmQGCki2shBbsmaY0xn+n ID/4hZzcB4JcJ2SxLXcvrTaEIdaakL7QjbvXk7ZLK2PUJI+pEvgbg6JnLl40EJha5NO+ TRKSPGC4Vh77Pc+qZoWXmgISt5sABc21AfMJxEHe/j7FGoxzu4iV1I1UAKC6LptsYvHq 0mrrYOMjI5oxFxuJmA2PPTOJQfb6uQZH1X+hkuYXqsrblOtWa2ZY2OcQG8xuYXlnCWmW eMWw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=VCL/I+C7EDhk3QZnRZHiN9vowJ6gNZBgoXUMV5PsFrc=; b=UdddotqRMgYK1aZ9hmprwMrrGwINPUJM0uMtXhcDfyMUsXLSUuuvinVdFV16dJnSV1 gxkkZ7b5aTPKrkx7LYCj7zfB++Q6IdKElyeEnJfE6STX6eGn+6pcs3aN++xx6bvq6+Jp pdbtXd4mxCnrLkhkoZNfkSwtGrIUBJL2vCMDTvCD31WuhO0KtKzkdVnv/eRua2jqE6V8 AlnG61VSyW7njUczfR7TwAgmSobJZyNx7fL++ZLXO/U6KUbdL2psKQegJ0RzZVqetRqE HPlWGhhbiaUv6VnPJRKYh3xUgycvLkiSU+keamjU+K93ykGWVafUJYmoQMl+swSfRU+l 1AYg== 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 v11si9652219pgo.107.2018.02.15.08.02.40; Thu, 15 Feb 2018 08:03:08 -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 S1425459AbeBOQBH (ORCPT + 99 others); Thu, 15 Feb 2018 11:01:07 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:35970 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1424685AbeBOPqx (ORCPT ); Thu, 15 Feb 2018 10:46:53 -0500 Received: from localhost (LFbn-1-12258-90.w90-92.abo.wanadoo.fr [90.92.71.90]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 1741CFFB; Thu, 15 Feb 2018 15:46:52 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Bart Van Assche , Tejun Heo , "Maciej S. Szmigiero" , Jens Axboe Subject: [PATCH 4.15 181/202] pktcdvd: Fix pkt_setup_dev() error path Date: Thu, 15 Feb 2018 16:18:01 +0100 Message-Id: <20180215151722.327456425@linuxfoundation.org> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20180215151712.768794354@linuxfoundation.org> References: <20180215151712.768794354@linuxfoundation.org> User-Agent: quilt/0.65 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.15-stable 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: Greg Kroah-Hartman --- drivers/block/pktcdvd.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) --- a/drivers/block/pktcdvd.c +++ b/drivers/block/pktcdvd.c @@ -2745,7 +2745,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; @@ -2763,8 +2763,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: