From patchwork Thu Nov 22 19:52:11 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sasha Levin X-Patchwork-Id: 151819 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp1150494ljp; Thu, 22 Nov 2018 11:53:07 -0800 (PST) X-Google-Smtp-Source: AFSGD/UhTCdq/VJVsoS9H3r0uEYG7y6qAt1VMWXyqUMxrSMKiPyISlAW78RIIZy3eZ2jLt97pDlG X-Received: by 2002:a17:902:6909:: with SMTP id j9mr12187010plk.196.1542916386998; Thu, 22 Nov 2018 11:53:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542916386; cv=none; d=google.com; s=arc-20160816; b=amPnHBDFy/+D8tGWDDFWy00Ekgaprgdfful4n44c1wZ9BJOM4oa62O3dIP9FI6RXBO mLASX1/NcP87s74f66Np8kqjeQlRVi8ELMVpGo+a+rw/Wh4wGHMK8pWhv7XBYuBSCSWS 3bOQAsWlH41a/3POjCimLeI/RBhqqmiXYFBBCvMFaw6ZyaihB2RcKfa+sAKlY9zZj4Tq IqFaafDC9Chfj1XFiw/7cFPnv1UePZ2lqVJlZC9CsQCQZ8XSREERm0NuFV8NImhlrTeu uSzL+Nsa6lTvA/a/r/GsxBnXAYOi8ZrcPBHNIM9WdLS+8vkk0KbXgL/D9aioQvHT9J7E Bz1g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=b4HsiPv7yXNct09SJ/VPINKlmYqqe99p0s4knWduRoA=; b=fyb7s9yz5d0libTBxfdkFp08enyNHq6gE0pvpfj5Zi6/eh40q1V9N64wX7Xawt4POJ f8njx/HzhoI56t9nhaLhU851o2Ij3A421rTRkohzws7sWk2ecetwK0hJpRLUXM4ncZH9 SOiccNnnKG/Y3fDmwmMrlw1NtxKoTO6uAVcT0S9bmD0hVVx+lLncajYdKqxWTUbGwhhV 5/f0rWfoCJse2LVaYbYkjrllP44bX47fsjzF7kYJIfteBO83G3gLsXYp346LmfcXLAMv oD7Os3rzMM2R7U8q9Vp/sDtJhm5eLpzzSRNfiIyaMcVqAfZ/AqDsmFJW2xiPb9QLk5+2 A14w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=BCW4YfJc; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j8si18029411plk.145.2018.11.22.11.53.06; Thu, 22 Nov 2018 11:53:06 -0800 (PST) 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; dkim=pass header.i=@kernel.org header.s=default header.b=BCW4YfJc; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2406831AbeKWGd4 (ORCPT + 32 others); Fri, 23 Nov 2018 01:33:56 -0500 Received: from mail.kernel.org ([198.145.29.99]:32980 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2406810AbeKWGdz (ORCPT ); Fri, 23 Nov 2018 01:33:55 -0500 Received: from sasha-vm.mshome.net (unknown [37.142.5.207]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id AFA2B20645; Thu, 22 Nov 2018 19:53:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1542916383; bh=+3rM5jzdyw9D3Z3dXJaI+kXz2N0qo9OEd3GUZ2CRw9A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BCW4YfJc7GAGAhflBKW2rsCLFe0jeTUnbA8jzgvKn3Is2Bz67kM3B+XdffP81DDRq n051Qc4TXTVDLQvAWDrMY3gjXx0LpXbByaQwKPmsq0sYqzNw51Srk+7Xsyfa/IxJci c8Twq9EIVvasdYM8vGG04cAaY+RsrduVJJEDha2I= From: Sasha Levin To: stable@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Arnd Bergmann , "Martin K . Petersen" , Sasha Levin , linux-scsi@vger.kernel.org Subject: [PATCH AUTOSEL 4.19 07/36] scsi: lpfc: fix remoteport access Date: Thu, 22 Nov 2018 14:52:11 -0500 Message-Id: <20181122195240.13123-7-sashal@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181122195240.13123-1-sashal@kernel.org> References: <20181122195240.13123-1-sashal@kernel.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Arnd Bergmann [ Upstream commit f8d294324598ec85bea2779512e48c94cbe4d7c6 ] 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 Reviewed-by: Johannes Thumshirn Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin --- drivers/scsi/lpfc/lpfc_debugfs.c | 2 ++ 1 file changed, 2 insertions(+) -- 2.17.1 diff --git a/drivers/scsi/lpfc/lpfc_debugfs.c b/drivers/scsi/lpfc/lpfc_debugfs.c index aec5b10a8c85..ca6c3982548d 100644 --- a/drivers/scsi/lpfc/lpfc_debugfs.c +++ b/drivers/scsi/lpfc/lpfc_debugfs.c @@ -700,6 +700,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;