Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp3110011ybi; Tue, 2 Jul 2019 02:19:15 -0700 (PDT) X-Google-Smtp-Source: APXvYqyea/CVtvTb2omLSr3tzOgIIx5VpBOoenGdUusnzDfDZxt9w9nkf62KEnIfoI7WTQrVAzZH X-Received: by 2002:a63:755e:: with SMTP id f30mr21367263pgn.246.1562059155573; Tue, 02 Jul 2019 02:19:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562059155; cv=none; d=google.com; s=arc-20160816; b=AtXPAyzozasrsOfPuJ5j3KhIAWw7fEbWs2Rhlv0pJcNDjeY31UEtH3VqjL7JGFVu2O /4GNK12Du95d6Efiecx8XipSMVysglEMxBar1gRCmVWJ1ICzXMYO0zsKJmHsjunDAR0G PF16eLfDg9YrcKxw0se0xnW9HuMRFLCPri5PydDHzklOFzBfSwHoMeerXB1F/Z0E+zrj jpmB7KBrfJ/52CVor5Biy1jdXVfNKmCic4L4aF0zS26xZKK1wIW3NctzvLzEio22VGVl pKDdOrs62U/LBEzl31Y7mEVjgWxdeZ2EKmfH2NYWwjCX+wK9MUIM9lr+3PalXWbBDhUa e5kQ== 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 :message-id:date:subject:cc:to:from; bh=xSUEtRfsB9KDj8kkTKD4+XZucB5f1vGa5fYSGRC/L9s=; b=vIYqdr6DBEd1hkEhsHsu7VtnwG+F4JKCqwJqOGvYGLhEj1JZx9KzR4GHdAls3P9O4B 9RV85x+dPX7do+y+pQBn2jdidx6ucs26MOpdHcvtD76YtIZGQmfjIyfLGluGCfb93XHF EjaCeNRqEAZUto2VO9V/C02xz51gLrkQ1lhV5ryIrI0YcX7QW32qfYRccAt2oTzpnHLh JFRywTO2r5uQNwuNb0Hey/1JmqlVX53HKBaNvS/39A7IP1auCpI2dfKYhdJ0M0Q4ldY7 C/1R125Y7IL5L3sFv5k/eiQs4sMzmoNzRLFmiLeU/g+egQVC3Ng/QAggDeC0SeCIC9Jz s7DA== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=canonical.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r19si2672582pfh.50.2019.07.02.02.19.00; Tue, 02 Jul 2019 02:19:15 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=canonical.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727109AbfGBJSk (ORCPT + 99 others); Tue, 2 Jul 2019 05:18:40 -0400 Received: from youngberry.canonical.com ([91.189.89.112]:46472 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725851AbfGBJSj (ORCPT ); Tue, 2 Jul 2019 05:18:39 -0400 Received: from 1.general.cking.uk.vpn ([10.172.193.212] helo=localhost) by youngberry.canonical.com with esmtpsa (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.76) (envelope-from ) id 1hiEvr-0003N0-Um; Tue, 02 Jul 2019 09:18:36 +0000 From: Colin King To: Hannes Reinecke , "James E . J . Bottomley" , "Martin K . Petersen" , linux-scsi@vger.kernel.org Cc: kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] scsi: libfc: fix null pointer dereference on a null lport Date: Tue, 2 Jul 2019 10:18:35 +0100 Message-Id: <20190702091835.13629-1-colin.king@canonical.com> X-Mailer: git-send-email 2.20.1 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 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 --- drivers/scsi/libfc/fc_exch.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/libfc/fc_exch.c b/drivers/scsi/libfc/fc_exch.c index 025cd2ff9f65..c477fadbf504 100644 --- a/drivers/scsi/libfc/fc_exch.c +++ b/drivers/scsi/libfc/fc_exch.c @@ -2591,8 +2591,8 @@ 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 " - "has not been initialized correctly\n"); + FC_LIBFC_DBG("Receiving frames for an lport that " + "has not been initialized correctly\n"); fc_frame_free(fp); return; } -- 2.20.1