Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp925781imj; Sat, 9 Feb 2019 10:57:40 -0800 (PST) X-Google-Smtp-Source: AHgI3Iaxfuy00SoS9tQx8HNskAMSy3t8lRBKa8/sK3Bdco95yfKP1q0RpKGykoUtt97RyXba/BQa X-Received: by 2002:a63:6984:: with SMTP id e126mr16909018pgc.143.1549738660311; Sat, 09 Feb 2019 10:57:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549738660; cv=none; d=google.com; s=arc-20160816; b=hZdYNE8/saBxU0hTeOPGvDwVF8/28rVNH1VhO9d99rEIR+M40sjklkZwQBo62mz4YB SCwvtl8RCugy2N0rDQX3NGEvh2qKUKzwbOpnvYCSD5RPSxIaCEbDxluysjF6+cLJAaIw rCzkBdXqrRPDmpKo3t72brX5RxT06ORJ8pP6ZjQsD7tJTq7z07H9q6rYUqndZvZvVsy5 LAZ+CzG5vYELbbwZDDKzycKWV7uzBa6RIrQ+DIOGnOuIA2jsYbYTbo6Zlj+5FrCFSMOR XAv8bwBt4vmYtKK+RzdeZPTUNtjE0Qw/F43zmsJtZaggNr4tGHQByd5GsZJYfb05CdQr B0yw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=O+yDceeMeg+UJ1Bpxb6q2lUoSTmVI4rAFd7Xl9XK1ro=; b=OFm1Gw8vIyUbNVgOxI/Dvu6ZZPaLW5TPjEw8EQk9VDbfem5Lq2YdPEORMVcPSe3XjX mw9K0/w+V0QQkToXfdcVufsFIWxFJNCmT8EM0U2r9lXzqB3mPrZTbabQdTkV269sBw+8 NPOntg5ZToXofsRUG7CfuJfNkA1JxxKw+oTysQ+U/i+RPmlpjWpHrzaFmvaPJhM4mm5O J0UZaXK5US5Gf9UFTE2l88erKPcfsiedBKhL3GkZ29SFdX7HGgZhcQll8sjzc8MUyhwp s+u2GkqygK1pT1oW2+xOVn8Ag6csCEyhzAlDdnoHtcsZ+WKhpmwIH+1pYa3BZRUztQVB l18w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=d8ojkPS2; 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 23si5408023pgc.221.2019.02.09.10.57.24; Sat, 09 Feb 2019 10:57:40 -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; dkim=pass header.i=@kernel.org header.s=default header.b=d8ojkPS2; 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 S1727960AbfBIS4a (ORCPT + 99 others); Sat, 9 Feb 2019 13:56:30 -0500 Received: from mail.kernel.org ([198.145.29.99]:60874 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727504AbfBISsA (ORCPT ); Sat, 9 Feb 2019 13:48:00 -0500 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 9205D2192B; Sat, 9 Feb 2019 18:47:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1549738080; bh=l5b9oeVKvvO/ON5fswllXO8ogbeNs033M5PTGo7XOT4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=d8ojkPS2l9CWnkiLPjNZkvYw6uwb6iX2/2C3DBHRd6Hm5jrswT1k/VGBIqc6VAH2O nwdRv3yeikLAuEhW9zvnremgz5I9D5CmK/L1NGBnLlHaHZQ33YYUHAuS6M4wYEv5Qe o9kFwDeiVRFGswas73/o1V4fZ8tQBkJ8xXwiJinc= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Hannes Reinecke , Hannes Reinecke , Christoph Hellwig , Sasha Levin , linux-nvme@lists.infradead.org Subject: [PATCH AUTOSEL 4.20 23/42] nvme-multipath: zero out ANA log buffer Date: Sat, 9 Feb 2019 13:47:15 -0500 Message-Id: <20190209184734.125935-23-sashal@kernel.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190209184734.125935-1-sashal@kernel.org> References: <20190209184734.125935-1-sashal@kernel.org> MIME-Version: 1.0 X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Hannes Reinecke [ Upstream commit c7055fd15ff46d92eb0dd1c16a4fe010d58224c8 ] When nvme_init_identify() fails the ANA log buffer is deallocated but _not_ set to NULL. This can cause double free oops when this controller is deleted without ever being reconnected. Signed-off-by: Hannes Reinecke Signed-off-by: Christoph Hellwig Signed-off-by: Sasha Levin --- drivers/nvme/host/multipath.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/nvme/host/multipath.c b/drivers/nvme/host/multipath.c index 9901afd804ce..2b1d1f066efa 100644 --- a/drivers/nvme/host/multipath.c +++ b/drivers/nvme/host/multipath.c @@ -586,6 +586,7 @@ int nvme_mpath_init(struct nvme_ctrl *ctrl, struct nvme_id_ctrl *id) return 0; out_free_ana_log_buf: kfree(ctrl->ana_log_buf); + ctrl->ana_log_buf = NULL; out: return error; } @@ -593,5 +594,6 @@ out: void nvme_mpath_uninit(struct nvme_ctrl *ctrl) { kfree(ctrl->ana_log_buf); + ctrl->ana_log_buf = NULL; } -- 2.19.1