Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp2994549yba; Mon, 22 Apr 2019 17:24:23 -0700 (PDT) X-Google-Smtp-Source: APXvYqzY2JKjma49R5PadEF37VRZq5IVyiVIj8nk0m/jut+wq2QG1dKg1qCfePPKEfrJaYUSBz2c X-Received: by 2002:a63:fb4d:: with SMTP id w13mr21960931pgj.397.1555979063575; Mon, 22 Apr 2019 17:24:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555979063; cv=none; d=google.com; s=arc-20160816; b=yngVdpJ1U7npHT+2LxxDCHXxQmjy3PTNo+aflvHPmGvrIE/27RAAbaQ7ZPZ0z9GWbH jWoIaRfvvtFuVNZuYqWvOO9HaZfCc/0M/mcl2GWDSe0Diy2qm8kzNLlHYhAigmFqh0KJ HVsO6dTw5yJpxzpj+fN6D+L5JOBYU0UVGlIAeHCuCg0EHCBSekgHLOBemHaZH5YnZj9h 7zhmALzThZUfJb0+4YpH8FsfmBoUbYHxBggM1yoEanCxcBb1KMMvXAfyMl2t6XOzZnym Zgz611oimrxhoyB+QFTscJf39Se0udT6I4BHg7dDCgYAvLNPZpVTJG3dBYC9bMBg0eAe DvPQ== 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=uWu5lqDjuNQ7pFb207m9rVRIt4oASYsId5LP2+13TeU=; b=weDb5WK26ySld2Wuo3suq2pyvqyWhs7EyoADTkCDzkeM3cQ3BQlmYuTipgt7v957qz vM3If79EQuj/tXwfOkYaPUDoIvVKvdGuWFXPOCs/X2gaaKUH182Pm6wuCusG0jsxUWnl gQx0WSkjlFxXS6aiXumlktT7XJF6IuPK5vK9h2yIwaX0HIU7YVqG71P3ZuZAUsNmGU7r kmKEwCJxF+bEBRJJnZfGxbLw12MrBAQALc0ltelxfgQ25FZHGO/f5hyFXCPh0z2cBp6q 4hnFaVqx9L0czP7ktA9AQzTXtLgmJ8TL74VmqUOLYWe9xABxoqwbYDY6jCbwhVGql0hL XuqQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=B65EBOzn; 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 a20si13110669pgw.465.2019.04.22.17.24.08; Mon, 22 Apr 2019 17:24:23 -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=B65EBOzn; 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 S1732389AbfDVUHf (ORCPT + 99 others); Mon, 22 Apr 2019 16:07:35 -0400 Received: from mail.kernel.org ([198.145.29.99]:45096 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729372AbfDVToJ (ORCPT ); Mon, 22 Apr 2019 15:44:09 -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 53655218FE; Mon, 22 Apr 2019 19:44:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1555962249; bh=/LA3dyDA+MLhpzUu/yREsyxA+fm2x74sVFM9AppWYYE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=B65EBOznyqnVf7b64oseqIQAfG7p1ua6WahWQpcZN8QMDOoyj7ohpZDhmWy/RC3kW gTsLKfWjr+p5JGea3nCXo6DJyfdBzuc7ZD1KcJOGkDCBkFvx4DUh2sDyI02rC1G79m XeiCAwLIQA2OZovkm+QpxTg04xygJ5eB37Uaj94I= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Kangjie Lu , "Martin K . Petersen" , Sasha Levin , linux-scsi@vger.kernel.org Subject: [PATCH AUTOSEL 5.0 64/98] scsi: qla4xxx: fix a potential NULL pointer dereference Date: Mon, 22 Apr 2019 15:41:31 -0400 Message-Id: <20190422194205.10404-64-sashal@kernel.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190422194205.10404-1-sashal@kernel.org> References: <20190422194205.10404-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review 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: Kangjie Lu [ Upstream commit fba1bdd2a9a93f3e2181ec1936a3c2f6b37e7ed6 ] In case iscsi_lookup_endpoint fails, the fix returns -EINVAL to avoid NULL pointer dereference. Signed-off-by: Kangjie Lu Acked-by: Manish Rangankar Reviewed-by: Mukesh Ojha Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin (Microsoft) --- drivers/scsi/qla4xxx/ql4_os.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/scsi/qla4xxx/ql4_os.c b/drivers/scsi/qla4xxx/ql4_os.c index a77bfb224248..80289c885c07 100644 --- a/drivers/scsi/qla4xxx/ql4_os.c +++ b/drivers/scsi/qla4xxx/ql4_os.c @@ -3203,6 +3203,8 @@ static int qla4xxx_conn_bind(struct iscsi_cls_session *cls_session, if (iscsi_conn_bind(cls_session, cls_conn, is_leading)) return -EINVAL; ep = iscsi_lookup_endpoint(transport_fd); + if (!ep) + return -EINVAL; conn = cls_conn->dd_data; qla_conn = conn->dd_data; qla_conn->qla_ep = ep->dd_data; -- 2.19.1