Received: by 2002:ac0:98c7:0:0:0:0:0 with SMTP id g7-v6csp180072imd; Wed, 31 Oct 2018 16:56:27 -0700 (PDT) X-Google-Smtp-Source: AJdET5fchODQ4Pv2TksNjCZvECFeSnxZn4PVMpjxvF1wLgz6DfGI8FYv6BAd3G8ksAJQ7mbeqIlr X-Received: by 2002:a65:5a05:: with SMTP id y5-v6mr5016900pgs.161.1541030187025; Wed, 31 Oct 2018 16:56:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1541030186; cv=none; d=google.com; s=arc-20160816; b=hYNClICXvu34kXsNB9cw0gEVcHYKaC3JMsARPwBmx0g39Ei7po43TQuhPX06cNrK3i KUQGCqpv2DDJaP7hIKvYHr9cYzS1/KmBRxN0ne9RhyUchbcFRx77iBLIW3gl1PEVpEcl ku4Yus+SmdeQtmr6XSoG4envow9JvFy111ZSMceIOxj2v2fTpYBVye7WXbXwiklG43FG LXnZoTxd5aVXLQD2lcdQ+u6CxXHm8hvks+355CY7YWcOJuFAbKui/2y7EQDaacp5Mqot dfd+Ip6Y8frqXdeLhZBGnonuS85uuSogmbkqXxNJK2W3ET+IWk3VEfHhG9fMIjVdjwDK 2thw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=y3fWl/3RiTRou08DjEovp1iKz/GKneEpRhRsEQntud0=; b=A6vut2fzyKVDPU9H5sDKerNLqxDQSny8LDytWCtICA6qn3uro//yVE4kwu5Cwso8I8 l5BrBEZM6nZ3Sl1TTyOaZNL4j8j6qKcMjVZQ/1srGQh8xcZymXv1EGFcWbnYa5i+ePv4 l3AJvLCChKXotlVCI0dhdXrLmjxrOEeeTi6pRBPU6mcnfV1SgFdmc2NJ2HgFkkEytITL 9ZXYf/Hw8m4NDG2tqqrdiUu/Bdk6bxmOzfp67uUoq8tkhlDuHYAwjYwPq7fZaTeqKp5q MDM+Cy39JAwCh31enbSamPy5D0F0iD9bWGCO/RtjT5TSXlGyomFF3yYWqIwQK1n5tYbn QcsQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=xgUijy5M; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w1-v6si10522185pgs.112.2018.10.31.16.56.12; Wed, 31 Oct 2018 16:56:26 -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; dkim=pass header.i=@kernel.org header.s=default header.b=xgUijy5M; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727698AbeKAIzI (ORCPT + 99 others); Thu, 1 Nov 2018 04:55:08 -0400 Received: from mail.kernel.org ([198.145.29.99]:52622 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726752AbeKAIF7 (ORCPT ); Thu, 1 Nov 2018 04:05:59 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id D167F20823; Wed, 31 Oct 2018 23:05:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1541027149; bh=nH/00+aBMSpJ37rlZrcLUeAkO7BWS4+oo7lO45Cnxhk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xgUijy5ML47A108bN2ngU4m+pwamt76ehZzerh+8dD7l2ejSu23oSDvUMzcTEV+h5 EmtVZFnzFICl9aLw10mXCOFb3M7LOFs+F8gVs+iVMaPfkkrV+y/MIHTeI71Gds/AUj Oxz7h8wKkuc3zYQW2nzjFKPGTiTJY8k/oENSdE+E= From: Sasha Levin To: stable@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Omar Sandoval , Jens Axboe , Sasha Levin Subject: [PATCH AUTOSEL 4.19 007/146] swim: fix cleanup on setup error Date: Wed, 31 Oct 2018 19:03:22 -0400 Message-Id: <20181031230541.28822-7-sashal@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181031230541.28822-1-sashal@kernel.org> References: <20181031230541.28822-1-sashal@kernel.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Omar Sandoval [ Upstream commit 1448a2a5360ae06f25e2edc61ae070dff5c0beb4 ] If we fail to allocate the request queue for a disk, we still need to free that disk, not just the previous ones. Additionally, we need to cleanup the previous request queues. Signed-off-by: Omar Sandoval Signed-off-by: Jens Axboe Signed-off-by: Sasha Levin --- drivers/block/swim.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/drivers/block/swim.c b/drivers/block/swim.c index 0e31884a9519..cbe909c51847 100644 --- a/drivers/block/swim.c +++ b/drivers/block/swim.c @@ -887,8 +887,17 @@ static int swim_floppy_init(struct swim_priv *swd) exit_put_disks: unregister_blkdev(FLOPPY_MAJOR, "fd"); - while (drive--) - put_disk(swd->unit[drive].disk); + do { + struct gendisk *disk = swd->unit[drive].disk; + + if (disk) { + if (disk->queue) { + blk_cleanup_queue(disk->queue); + disk->queue = NULL; + } + put_disk(disk); + } + } while (drive--); return err; } -- 2.17.1