From mboxrd@z Thu Jan 1 00:00:00 1970 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 83713C3F68F for ; Tue, 28 Jan 2020 14:13:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 50A1E24694 for ; Tue, 28 Jan 2020 14:13:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1580220822; bh=QpXlaaWH6ZWk0u4zthffb44DZkzkZisi06gwOjkBMXc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=zOiymhXhLRoAu0XUKX0NvZPUlK9rY+Vn5JCnI4d5naIwanU6kcMtyxN8+j3dhrSCa vQ+lhNAtZ6mpqtysVCl+fZKH69nyzvssHNns5f+gzPfuMXvyo2GwIGa94h1U5aSBPc NJ/fOptwn8NQ4KLF3ng0vUskeFpkB8lb+BY3JgMU= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727112AbgA1ONl (ORCPT ); Tue, 28 Jan 2020 09:13:41 -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 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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; -- 2.20.1