From patchwork Fri Nov 2 15:35:48 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 150055 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp2222673ljp; Fri, 2 Nov 2018 08:36:29 -0700 (PDT) X-Google-Smtp-Source: AJdET5d17HT+rOKdsBfeaZ6R6lCmyfgywCTrWhoVo39AgLlimzMitaf4Ekp9zmEf6an0YEiF7Ymi X-Received: by 2002:a17:902:5a43:: with SMTP id f3-v6mr3316552plm.57.1541172989445; Fri, 02 Nov 2018 08:36:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1541172989; cv=none; d=google.com; s=arc-20160816; b=Afp5LJfZxulXhb6Ks5t+G10WfeO2tfLPPaPIShwcsKivn/pERKffJwR4ZoyFhfDvEl CXFC5RoqMraQZROukVFxN2erTdvUHzHbD6XaTn3gl6mVVqJY2ygwxe84u2EhiQQmq/Dh 63/6LBLcIjbOV16v8H38j2bFacgfd0sqv1UmH2kTZ5J+izpKehRMzn3/QR3jCxVVSUG1 4fx7vFpOoZDLmCcHAh4t/imVhsvQAYqJD3lzOFj0QY68OKQ9aWrDONrI2tzTH47dxvo+ Mp1iWG0wRdcpGgNZbY5I0FJ8OnWNHhjEdILGoOs2sSofFSAOti0wCfallF7Yg7YpxDgi VDRw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from; bh=zqzr0Ggl9TV1XvCCFKzeFnXVm287Mkv7XunTkedVh+Y=; b=gOQe1Y2ZrUtiHSf4GII7zTRWDipy/jnDXCShQ7Yv73C66IhMPJbZlv5Hq5zStGZM+T qe8KTX+8YF5qDan0N05TgA3KEHzUiOs2EnN2v+7//9c89d04rZTjZTAQUOagMRqDkI/M WFhEcsW8jwVFs6RnMopU8Av2EqdIFJIug90j61i903c0XMPMogLWc6DdOEH8wJInRfqk BcCj2Q6fT/lBr3mus5wm7oIbOm+9ChUKo300YdyqEVAMcB57inp0SDXeoOUgFo0ti85J GEaEBrIuxoOacr85EtIUVkPPxia+Od9FJ7nVTswZXL7xTc7qPLACyfUxy4+Hezm6lnO7 34dw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-scsi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-scsi-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 m3si6332165pgs.8.2018.11.02.08.36.29; Fri, 02 Nov 2018 08:36:29 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-scsi-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-scsi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-scsi-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727065AbeKCAn4 (ORCPT + 1 other); Fri, 2 Nov 2018 20:43:56 -0400 Received: from mout.kundenserver.de ([217.72.192.75]:47471 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726049AbeKCAn4 (ORCPT ); Fri, 2 Nov 2018 20:43:56 -0400 Received: from wuerfel.lan ([109.192.41.194]) by mrelayeu.kundenserver.de (mreue107 [212.227.15.145]) with ESMTPA (Nemesis) id 1MLyvH-1g1DCE27Pd-00Hxa0; Fri, 02 Nov 2018 16:36:03 +0100 Received: from wuerfel.lan ([109.192.41.194]) by mrelayeu.kundenserver.de (mreue107 [212.227.15.145]) with ESMTPA (Nemesis) id 1MLyvH-1g1DCE27Pd-00Hxa0; Fri, 02 Nov 2018 16:36:03 +0100 From: Arnd Bergmann To: James Smart , Dick Kennedy , "James E.J. Bottomley" , "Martin K. Petersen" Cc: Arnd Bergmann , Hannes Reinecke , Johannes Thumshirn , Vasyl Gomonovych , YueHaibing , linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] scsi: lpfc: fix remoteport access Date: Fri, 2 Nov 2018 16:35:48 +0100 Message-Id: <20181102153601.1599945-1-arnd@arndb.de> X-Mailer: git-send-email 2.18.0 X-Provags-ID: V03:K1:MQRaELqsp5ENIDgNMPWwHMaVnT4QRa1GYKgTmcb0eqtBsOv2R48 u3LCMRl2p4e4e7ji9gfunn3yWzYz45bfjI2eG9Jt8NE739He/ZtrzhYhqC3av05pBG9GHbH TTZhONwF3YA6gjFbZoHqQPfWmM9ijo4RRcZLgeu82VY8tCpFnnjyBn7vAm27MNIvCmSfsYb 6S5uA8ScpZCU9kLe2d9sA== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1; V01:K0:C7XGLKoSRDw=:U2FMBNTkUKfFHTD+w/HJEO HWbAQHJUh+OB6TiU+nrWd9AiapVmnYk1fABSRhlfJO1EYs052ozAtSvk87WNQnSZHCqr7sJi9 2vDxsiY60lFYjgP4VngIRmDmUaI1pyJ7/030fBHszqp3DLuplOSEUWtTknylERq86YP8CNLeA H28uUPTpZv8LZvajGwJnwqov6wmtj8J5m/vOQCICYSmAsHxMzZ9fZIcZTAUQFgE3w5Ie8qNIY iBHsbCbs9iLVXUOyX7AfmYH15e0maMEKjk8OgJ3pj2ZH16JHFH54mdjQ6d/CUo9pXP/ivP3fX P3FaZPqv5M619CNgrGHxFu/yIZjd5VJiCTqUGDuqUtbCWYgxsh50HVsJJ4fIi9ejT0JJjcpnI 0WHVgOL0r69oHue6pGDe7a4G1hfFCrraXyj9cUYt86CgCGgrhylKRc3jUhPE0UkMFf08CotlM plBxMYfsQTMgcldjAkCwOqy4qCl1dDKuMuZBlJcjbAr8XkCdePedQKpaEvFF5kmSgGhDcQICP Nr8tP6LUcQOed6WjITeelpJ/OoasvRvZR0qCVAJmO37INImVzi4aAzZnjxhIsJA8TfAqU60BC CW+Ga4LAbRlPpaXxHjMRq2ct6qtxAyJ+1EU+AL3DTQm/nxApf7U7kgsX3g7SX1vDHAJ5QPBUs eDqgyDkRspDz1zs017fVHk3jaV10UyrrZJYpA0wQICJb5uN9G9wzcpEa7zCao9XNC/vA= Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org The addition of a spinlock in lpfc_debugfs_nodelist_data() introduced a bug that lets us not skip NULL pointers correctly, as noticed by gcc-8: drivers/scsi/lpfc/lpfc_debugfs.c: In function 'lpfc_debugfs_nodelist_data.constprop': drivers/scsi/lpfc/lpfc_debugfs.c:728:13: error: 'nrport' may be used uninitialized in this function [-Werror=maybe-uninitialized] if (nrport->port_role & FC_PORT_ROLE_NVME_INITIATOR) This changes the logic back to what it was, while keeping the added spinlock. Fixes: 9e210178267b ("scsi: lpfc: Synchronize access to remoteport via rport") Signed-off-by: Arnd Bergmann --- drivers/scsi/lpfc/lpfc_debugfs.c | 2 ++ 1 file changed, 2 insertions(+) -- 2.18.0 Reviewed-by: Johannes Thumshirn diff --git a/drivers/scsi/lpfc/lpfc_debugfs.c b/drivers/scsi/lpfc/lpfc_debugfs.c index 0c8005bb0f53..34d311a7dbef 100644 --- a/drivers/scsi/lpfc/lpfc_debugfs.c +++ b/drivers/scsi/lpfc/lpfc_debugfs.c @@ -698,6 +698,8 @@ lpfc_debugfs_nodelist_data(struct lpfc_vport *vport, char *buf, int size) rport = lpfc_ndlp_get_nrport(ndlp); if (rport) nrport = rport->remoteport; + else + nrport = NULL; spin_unlock(&phba->hbalock); if (!nrport) continue;