Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp199812imj; Thu, 14 Feb 2019 18:32:05 -0800 (PST) X-Google-Smtp-Source: AHgI3IbHsciGovKEaVB/V7rxfMzcV/WUIYv+UuKumoSVHlGlVz6sBMCrVTnBHzwG1+n9oflh3hvO X-Received: by 2002:a63:6506:: with SMTP id z6mr3066617pgb.334.1550197925668; Thu, 14 Feb 2019 18:32:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550197925; cv=none; d=google.com; s=arc-20160816; b=Y6LADkwlia80/YDLrl4Fyrqis222RNz221CgEDZhdKDh7D7LzJKOV/5viNq+Bll7Gs +qLIWEV79Gf3z/E/cuLe0FacM4l2ieqBGmx7CPRL1sjx+9ZpC6oLAIRRDgErFFobu1pT bvgqrf71uOuBdDfjDIy9kDgV07May7VMKLCwtkzuD1gaXTJYJWpj6cMnhvqJiHMe9pJ3 ujAs7ZbJEJ+vI75vVsjfRVf8rFmF4dI470pUXeFysJLXPDjF7Mpf/5wHwsx8Xe6UI1iI IwIl7hBeAjE9gehDXYh+jqlwsjLGo3ayyYUp5fl34LJ/z+tXrT4qEzxdSP0BaiFHhU2f Cekw== 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=4Q2/jG0HQW1E0xQDNvIbXaYfy/fWR94b7h5oaOkpuWE=; b=hnNQOkvh53bwhoKT2Fy56tHEuJJ4kHKwFbRWpcLYCvi36/na6DPOrBZlPTdeo5kHYB vy8Oc2jnNr4u3ZhIThHRSVL4YQybbAm8clqQB8MHFeyzvUc7d61sM5jpRQ4kp+iQ2i8S pjJMGlORAZJsvEM8dOJvgLDTor9ZSTgD7syvdv6sKSdbSTUlvfa3q1gpMFvT49zo5yGY Ry6SwtOg53aMKglB1Jce8ZXmjJ/oNo0EGvk2WEYcwZ4LSiB9rhrozruoc6doa63guK8t 5aBkXqrWxT0QbDBmIOwj/OuoHz4iCKablL2zGWyjGNqrZ41uh9y8V35E8FpPkICalx2N Ffbw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=GnZ5GM2K; 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 p14si4001653pfi.12.2019.02.14.18.31.49; Thu, 14 Feb 2019 18:32:05 -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=GnZ5GM2K; 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 S2392241AbfBOCQJ (ORCPT + 99 others); Thu, 14 Feb 2019 21:16:09 -0500 Received: from mail.kernel.org ([198.145.29.99]:55572 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2406128AbfBOCQD (ORCPT ); Thu, 14 Feb 2019 21:16:03 -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 564D220643; Fri, 15 Feb 2019 02:16:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1550196963; bh=UR4BQN/gdco10enQaIYrBzp6LIkOIEtBXEDY3CrVDKY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GnZ5GM2KcFtz0KoiQjcrWjbf7aaV7c115WSrgJwgGyTo/jwJ6JTD5RH8wM3LToOdH CNdbdNh4rtVFQE2zDmsRDDttf6WgyXlcGmMcFoPFXi2XuXOq2dP2ObKm+OZVQvmgxg 8kz0BEAgC619wZ0UUo4p9YrcsKUhnEVh4EokNX9E= 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 3.18 10/16] scsi: csiostor: fix NULL pointer dereference in csio_vport_set_state() Date: Thu, 14 Feb 2019 21:15:40 -0500 Message-Id: <20190215021546.179605-10-sashal@kernel.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190215021546.179605-1-sashal@kernel.org> References: <20190215021546.179605-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 065a87ace623..22b800b5ac7f 100644 --- a/drivers/scsi/csiostor/csio_attr.c +++ b/drivers/scsi/csiostor/csio_attr.c @@ -582,12 +582,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