Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp197912imj; Thu, 14 Feb 2019 18:29:46 -0800 (PST) X-Google-Smtp-Source: AHgI3Ia8G7VX6w1bVGA4cR6KrAp/k8VqEKtxoKSkMAX+n7m/YqkJgFKxos4aRMkBcZBYCJUraBTk X-Received: by 2002:a63:1544:: with SMTP id 4mr3117578pgv.290.1550197786014; Thu, 14 Feb 2019 18:29:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550197786; cv=none; d=google.com; s=arc-20160816; b=R79gxBP6mFbdeldIIQ2J3Lf1luMbINUmaI+8xNngj2upBQTfU2ksiOlBnMCj4kepa/ Lz2udyISlnD2HqdkzjLjlnxwjprhn6LHpPSgBzHkxqBAbkSCUKRmvYYcS7UFQcjMxWlC V6jDxPImVuzT2w2pP36ypn0ZmvIC6Deud3fPueUSpe4EAFXdjDoezUb2vmD1dDpo0Q5H xQIyR2+CHeWxdqbcP+EOVSiM2nlc/U7WJLVe/2MT5UiWpxlUV7qPkoy+k7GBhTtQmNwt uoyhkKhG4sLhv8DaOOTwwYMfIVkD3ZfydQbjGvHe5567aFYGSXOo3NfkdJhhm9324wc0 uzrA== 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=Z3yLrfmkGHEQ1V5zExTaHHAC2IRLS5CyDXRyD0DgOS0=; b=Tnes0cDfLEz6I6HWuHra5jUz2UDqiHWiQfSqoXqIvS6xgeSQwgJdDuR+ehz/mdYXKs FIXetdcg//wqmswP2/FIwogyF6Cx7BRKOO26P5PXnM5Z3jT+ObixF9iUWTrFicLk6bCs IbBw0LFJRwxfIoLWcB/fOVYmFfvH8HFye75kyhc79pKJ7nzVt8Lo6xZWrPfsPOtRFJaX PfzNWkIdoMRAXfo23Az26B8VolVCAdfLgKUwB8F69+vx6K7VLp1MPCl53l/qeFj1cTzl MZr/NJMPvvmFlRv2ffmj+WDeMuXPyMYJPCB8QkvdJAEvgvJOZ8rpFcNH8v10w/QAf4Lv rvcQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Bw70MViO; 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 v19si3979474pff.78.2019.02.14.18.29.21; Thu, 14 Feb 2019 18:29:46 -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=Bw70MViO; 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 S2390447AbfBOCK2 (ORCPT + 99 others); Thu, 14 Feb 2019 21:10:28 -0500 Received: from mail.kernel.org ([198.145.29.99]:50624 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390394AbfBOCK1 (ORCPT ); Thu, 14 Feb 2019 21:10:27 -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 3DC6A21B68; Fri, 15 Feb 2019 02:10:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1550196627; bh=5kaMNCHp606wM9T12sg0DOT1GGZW9U6u0Gthxa5AiD4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Bw70MViOaPO4gO6kkLFEvA+nw+cgZlc/pY1HaWW+GP4CaQMBv8kB+QW3LxfMxezgK 2mXTOtUiOo+jhs2LlS+HAGF4+7kszq7qXrZrG3qIDsjAM4gOnbju7umnsqSb+6Y+X8 LrCKjL2j5ClYOrHgbaGWmmkMmeEyZY1yEnVw0UPM= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Varun Prakash , "Martin K . Petersen" , Sasha Levin , linux-scsi@vger.kernel.org Subject: [PATCH AUTOSEL 4.20 53/77] scsi: csiostor: fix NULL pointer dereference in csio_vport_set_state() Date: Thu, 14 Feb 2019 21:08:31 -0500 Message-Id: <20190215020855.176727-53-sashal@kernel.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190215020855.176727-1-sashal@kernel.org> References: <20190215020855.176727-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: Varun Prakash [ Upstream commit fe35a40e675473eb65f2f5462b82770f324b5689 ] Assign fc_vport to ln->fc_vport before calling csio_fcoe_alloc_vnp() to avoid a NULL pointer dereference in csio_vport_set_state(). ln->fc_vport is dereferenced in csio_vport_set_state(). Signed-off-by: Varun Prakash Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin --- drivers/scsi/csiostor/csio_attr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/scsi/csiostor/csio_attr.c b/drivers/scsi/csiostor/csio_attr.c index 8a004036e3d7..9bd2bd8dc2be 100644 --- a/drivers/scsi/csiostor/csio_attr.c +++ b/drivers/scsi/csiostor/csio_attr.c @@ -594,12 +594,12 @@ csio_vport_create(struct fc_vport *fc_vport, bool disable) } fc_vport_set_state(fc_vport, FC_VPORT_INITIALIZING); + ln->fc_vport = fc_vport; if (csio_fcoe_alloc_vnp(hw, ln)) goto error; *(struct csio_lnode **)fc_vport->dd_data = ln; - ln->fc_vport = fc_vport; if (!fc_vport->node_name) fc_vport->node_name = wwn_to_u64(csio_ln_wwnn(ln)); if (!fc_vport->port_name) -- 2.19.1