From patchwork Tue Jan 28 14:05:18 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 232556 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BA27AC2D0DB for ; Tue, 28 Jan 2020 14:36:29 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 84B4D206A2 for ; Tue, 28 Jan 2020 14:36:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1580222189; bh=Ko9j2RnJHDSnhuDL5FBd/0ONSRujyE5lU0vvIsuBk20=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=drHLSvERx5gyUXYdfLAtJTyHhMCiuZ3fEIoZfjuc0SWqyZt9ipLyeyNJO1Kfww+nj t0+SHthAiRv8+juAQAYdVWITzplZAzXNchd+6n42Hre6k+wKTfcMehgF/t9T2kJM1S HhcDyfKSYt3Or0rDonWH0rvcbc0OnXxiSHbEBQ6M= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730059AbgA1OVn (ORCPT ); Tue, 28 Jan 2020 09:21:43 -0500 Received: from mail.kernel.org ([198.145.29.99]:47114 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731362AbgA1OVm (ORCPT ); Tue, 28 Jan 2020 09:21:42 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id AA00C24686; Tue, 28 Jan 2020 14:21:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1580221301; bh=Ko9j2RnJHDSnhuDL5FBd/0ONSRujyE5lU0vvIsuBk20=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wVsqXAlLFPD5qfABMMKVrSPmHaEqfBDRN1gaagPq+APRbUgNbwGwHEmRgBQSv9oBu tcVjzrDIZsNp8D7LrW+kgNC/nP5QXrGvNxWJpmOGgd5iBnDkIiTpdOpyXI1s1aLX+/ UsCuLz8uXMXDN0kVNLzWuihc4bvDt7/XHhOUNgvw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Colin Ian King , Hannes Reinecke , "Martin K. Petersen" , Sasha Levin Subject: [PATCH 4.9 169/271] scsi: libfc: fix null pointer dereference on a null lport Date: Tue, 28 Jan 2020 15:05:18 +0100 Message-Id: <20200128135905.156121550@linuxfoundation.org> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200128135852.449088278@linuxfoundation.org> References: <20200128135852.449088278@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Colin Ian King [ Upstream commit 41a6bf6529edd10a6def42e3b2c34a7474bcc2f5 ] Currently if lport is null then the null lport pointer is dereference when printing out debug via the FC_LPORT_DB macro. Fix this by using the more generic FC_LIBFC_DBG debug macro instead that does not use lport. Addresses-Coverity: ("Dereference after null check") Fixes: 7414705ea4ae ("libfc: Add runtime debugging with debug_logging module parameter") Signed-off-by: Colin Ian King Reviewed-by: Hannes Reinecke Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin --- drivers/scsi/libfc/fc_exch.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/scsi/libfc/fc_exch.c b/drivers/scsi/libfc/fc_exch.c index 16ca31ad5ec0a..d0a86ef806522 100644 --- a/drivers/scsi/libfc/fc_exch.c +++ b/drivers/scsi/libfc/fc_exch.c @@ -2506,7 +2506,7 @@ void fc_exch_recv(struct fc_lport *lport, struct fc_frame *fp) /* lport lock ? */ if (!lport || lport->state == LPORT_ST_DISABLED) { - FC_LPORT_DBG(lport, "Receiving frames for an lport that " + FC_LIBFC_DBG("Receiving frames for an lport that " "has not been initialized correctly\n"); fc_frame_free(fp); return;