Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp2845127yba; Mon, 22 Apr 2019 14:08:34 -0700 (PDT) X-Google-Smtp-Source: APXvYqw/oJPyCXBGWHx5yuzeD3vRxf7NPXYnzwvny5DPxFq2aqIVs2+ryWqApdKa+9w7rVIjsGkE X-Received: by 2002:a63:6503:: with SMTP id z3mr21340657pgb.113.1555967314425; Mon, 22 Apr 2019 14:08:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555967314; cv=none; d=google.com; s=arc-20160816; b=fY/yaueShEatUBCncWWTH42AUtzrPKNT/Vv5YMWpVKe33MG/cZ10vTOyZbDBPKla7L vzDB38BTekCI512TIHqTC/xuRAxoRxJhQo7eArrKnhSFC/curTppXLs+qHoiIdmXUblR dWuhya8BUzYgJ2qU+MLnPQ8HZ34VSG8eokOxKSNScnu8qbC9lW3Gm+37gaN7ls/Ai7bQ LdiXrD/fDUlDCSVQQmDGkXfGSp0NbMbfC/Kmr2FCmYVSKkpGoLD6HnDoA8mDNM2/4Ppd LwbV0a/0j81yMOrkFxyLfrmuvve5PM7ksIp5cTqNZ3fEYTb1MMkxTB0Fjmt8rL0VxYzL uK9Q== 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=5gsmiOX4EaygJxWScFE56x1jM66Bsu4lIpqlC2atoPQ=; b=L/pIzFylmCcQ4acj4LILmqAkBFMaZNdVCLz4srFymO5iCxWtqwo5BgBnFmpYSJl5DX SqLZgVSPhXvKED5OWX375tnRj0UTEwppFnkIqHxXuJuErRUv59f0erwW+u0BHMNKKdkY l36PwB2VbyrCmyMlSDC6sZWCTMKYoSk7tJAHYxujXF1efggzZEjCN75I27d/VoGlHmic Pd8bY5y4yRMFops/CGlknJGONPUba4xFI+ejiRkPbBHPCpiQLHAkxM3AU1hVSS7VOsJw nho5+828eNGyExL/e2forcu+0NWdCaBn60O73FdhYvLaxDCnOuXApaSoZMwgDdlepgJO 7Nbw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=F4EwcxP+; 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 g3si13946450plp.369.2019.04.22.14.08.19; Mon, 22 Apr 2019 14:08:34 -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=F4EwcxP+; 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 S1729360AbfDVTrF (ORCPT + 99 others); Mon, 22 Apr 2019 15:47:05 -0400 Received: from mail.kernel.org ([198.145.29.99]:49508 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730107AbfDVTq5 (ORCPT ); Mon, 22 Apr 2019 15:46:57 -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 9DE1021908; Mon, 22 Apr 2019 19:46:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1555962417; bh=Sw/2wYEhJrAJWl3uhdAn9SpbkNmK0Kw8XD8+Aok+H04=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=F4EwcxP+A0wrC36Gs3DLUagFTbdm/ay7Cy/8KPM8Aikbpv4J9SqF9eXqGZzVHtbsm UW8Yrc4kTI3BX0QJonZgAjTy6rfZY2mdNqvJDDvdCIH7iOETlDm9PnbBFziiE7QWrW omZrThLD77ptBjn+5u3QECJaJvKOv1r3iKK7miHU= 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 4.19 51/68] scsi: qla4xxx: fix a potential NULL pointer dereference Date: Mon, 22 Apr 2019 15:44:59 -0400 Message-Id: <20190422194516.11634-51-sashal@kernel.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190422194516.11634-1-sashal@kernel.org> References: <20190422194516.11634-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 575445c761b4..5dd3e4e01b10 100644 --- a/drivers/scsi/qla4xxx/ql4_os.c +++ b/drivers/scsi/qla4xxx/ql4_os.c @@ -3204,6 +3204,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