From patchwork Tue Jan 28 14:05:30 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: 232686 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=ham 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 60D46C2D0DB for ; Tue, 28 Jan 2020 14:13:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 2E5AC2468D for ; Tue, 28 Jan 2020 14:13:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1580220817; bh=QpXlaaWH6ZWk0u4zthffb44DZkzkZisi06gwOjkBMXc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=kKgLspDIhK3Qg6Hlh9Xo+10jMygh7MihQ6Hclt3JatKFs9IwK1yiYGqhFjMVjdFF5 3RfN5Q6VfnrJtm9Zu4VWDmsD/dqWq7zmKw0HRo+n7l96GjeLg2znkGy+0FkzhmQNC8 YROar/VYtNkcdFESCBjpjKfUcsENfUewMrB5q+G4= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729702AbgA1ONf (ORCPT ); Tue, 28 Jan 2020 09:13:35 -0500 Received: from mail.kernel.org ([198.145.29.99]:35224 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729187AbgA1ONe (ORCPT ); Tue, 28 Jan 2020 09:13:34 -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 2A7972468F; Tue, 28 Jan 2020 14:13:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1580220813; bh=QpXlaaWH6ZWk0u4zthffb44DZkzkZisi06gwOjkBMXc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WyMiTfXyuDfQU8k7nwvaSNnJ7sORjObPNhCTJLrnKa4/0Tq6T+adzhJRqS5kq70av 6hZ58jUbjlDb+zICR9aOCQwi/szNWGfjOp2twO5lAF6CxFVFJItl7y0N3ltPh9ngBh bdpT21No3FqU/PyFGeWrBIe+QZiaiYH4738LG2xc= 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.4 111/183] scsi: libfc: fix null pointer dereference on a null lport Date: Tue, 28 Jan 2020 15:05:30 +0100 Message-Id: <20200128135840.999965281@linuxfoundation.org> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200128135829.486060649@linuxfoundation.org> References: <20200128135829.486060649@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 30f9ef0c0d4f8..b20c575564e43 100644 --- a/drivers/scsi/libfc/fc_exch.c +++ b/drivers/scsi/libfc/fc_exch.c @@ -2499,7 +2499,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;