Received: by 10.213.65.68 with SMTP id h4csp37020imn; Mon, 19 Mar 2018 18:45:01 -0700 (PDT) X-Google-Smtp-Source: AG47ELv3midcwCCqnXIKQ9Oh8AqPfTWg4U0QSFHzKRDwTuzkl6B3pEMAKpo0es0Eoeaebo8+i8/b X-Received: by 10.98.4.196 with SMTP id 187mr7185270pfe.203.1521510301085; Mon, 19 Mar 2018 18:45:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521510301; cv=none; d=google.com; s=arc-20160816; b=N1vlnwhJR6jh9xnt14UW4IZihDtjtyQ1dsl7ZXbFXe7GSH1XcT1eql8jRNXQc71Zy4 U+llFgmBHgTIBakqpnwWtCBqwOspKfHNDuz4N2hh+UQuCx0keCHe67DrpZIHW5Nxp0wE +Bj6l6FGB1fkSboyavNUgbh2ZPV/vh/KV9dmxJGMq7RuwaDSRUCDV7hgfv9LUuEFOtwl JjV1X+8pzNshmdN9nI5eV1BsLvepF/yquPTTxhNRR9rWhzYROOqKoxble883Kchkc3LE QTAyI7AtRHt65kFqEd9hCu1unB84krdhCb0KLEcBWcVK281fZLp5xLwHSbefJwUd3c8K wbhA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=tR4LQnCLbDIFRPnywdUOvgAGQTbiSb/wlfMWL+ORAdo=; b=0fiH7qn0+wQqUOO+kNqJSB1jddNJ7KRiXGsgoA2CPgdwqk1sdRYadx6wJLU45UKaBN JWoCF6VF3h45gvPIx0m7O1EpU5nLaIYA2p9T+B68GtmyIS/c7KuWP9oe709U0qFepJv+ R55k9creQDJwzJ7Ce/H0xwuD7CM/uTDsF5p1CYaewncgqFNiUgcxe3kyK6pyz54rcx+O Td3clqTcw9H+OhyxeNM5PTrMF0xCIXJmj7ociw8sAcRY3PuGIUXn1Ia3ClncSIG+PBwu OowpRMlfl+usAFP63OGdi/LiDcdUHj+PaqXakeMmzBZC3dLr7wNVo+QP5R4avLqRwDxj q6gA== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a74si430938pfj.287.2018.03.19.18.44.47; Mon, 19 Mar 2018 18:45:01 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1032045AbeCSSnO (ORCPT + 99 others); Mon, 19 Mar 2018 14:43:14 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:53970 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S970298AbeCSSca (ORCPT ); Mon, 19 Mar 2018 14:32:30 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 7412912AD; Mon, 19 Mar 2018 18:32:29 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Quinn Tran , Himanshu Madhani , "Martin K. Petersen" Subject: [PATCH 4.15 39/52] scsi: qla2xxx: Fix NULL pointer access for fcport structure Date: Mon, 19 Mar 2018 19:08:37 +0100 Message-Id: <20180319180737.179326405@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180319180734.976730813@linuxfoundation.org> References: <20180319180734.976730813@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.15-stable review patch. If anyone has any objections, please let me know. ------------------ From: Quinn Tran commit 5c25d451163cab9be80744cbc5448d6b95ab8d1a upstream. when processing iocb in a timeout case, driver was trying to log messages without verifying if the fcport structure could have valid data. This results in a NULL pointer access. Fixes: 726b85487067("qla2xxx: Add framework for async fabric discovery") Signed-off-by: Quinn Tran Signed-off-by: Himanshu Madhani Signed-off-by: Martin K. Petersen Signed-off-by: Greg Kroah-Hartman --- drivers/scsi/qla2xxx/qla_init.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) --- a/drivers/scsi/qla2xxx/qla_init.c +++ b/drivers/scsi/qla2xxx/qla_init.c @@ -102,11 +102,16 @@ qla2x00_async_iocb_timeout(void *data) struct srb_iocb *lio = &sp->u.iocb_cmd; struct event_arg ea; - ql_dbg(ql_dbg_disc, fcport->vha, 0x2071, - "Async-%s timeout - hdl=%x portid=%06x %8phC.\n", - sp->name, sp->handle, fcport->d_id.b24, fcport->port_name); + if (fcport) { + ql_dbg(ql_dbg_disc, fcport->vha, 0x2071, + "Async-%s timeout - hdl=%x portid=%06x %8phC.\n", + sp->name, sp->handle, fcport->d_id.b24, fcport->port_name); - fcport->flags &= ~FCF_ASYNC_SENT; + fcport->flags &= ~FCF_ASYNC_SENT; + } else { + pr_info("Async-%s timeout - hdl=%x.\n", + sp->name, sp->handle); + } switch (sp->type) { case SRB_LOGIN_CMD: