Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp3199060pxb; Mon, 9 Nov 2020 05:25:10 -0800 (PST) X-Google-Smtp-Source: ABdhPJwVWxHQlDJuBO47qTK/IAYx/ZyU5oDCDaVJUp3Gx5u5gwZE+uozTv00CNgAHuxa59uVaTGO X-Received: by 2002:a17:906:416:: with SMTP id d22mr15442401eja.31.1604928310519; Mon, 09 Nov 2020 05:25:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604928310; cv=none; d=google.com; s=arc-20160816; b=qyYps3LRKt+X2I5d3leO/G8nBPVZCDOxPg0uEExYB+/yMQPb5qXwcaoFGlm8vVz+9X W7x4PJ3fz5rNlnb0iMmnaMZxW7w/R8XlMv1CKwvBuwkOW4ogXfwnAlmTDwpgC/v6KKbF 3emaOn6sJ0GClwJwlJtx+tRoJ3ASx+QctV81+xNyifK+Z0viVOm+oAB2JYCF57B3WAM+ wQ7n75cXoA9+ORdcPTsfZxc/FT7Uh0paUKTc12hlYRDApuLpJpj8QTHJu0hx7mM4IKRV HaiZ+qr13Czaz/Y+sx+4yBjUMHsG0xU0U5U/kKGmdBiCUhuNhmKsATEqNUqIun0DkL5B 6CxA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=q6DN/ps88vyp5whSNIAs5LzAI8X/7ZrhB9RdVNs2ZdQ=; b=aWlylOvTKI/51Goz56alaP8e2WFYfc3SSg/qZIh2VJzpkCu20HCrPz8KccENzk0TnG HAXqzMMhtAyUHpX4g6YrzkyDYwlurEgYU4lAj+l/sT3dd0Za7OqHyq9tLA96CNFNsbyV L77D46BiBdCyJ7xZM2trRBC7PKYm0RJOHS6HFOuImDchTvpYVIqX91qhC1zgHuG1xf1c KmeucLeGQihCNcG5ZA4sY+bb9N6qjDQky3ky/8VIaTsDYB825iLSFHVLGUyd/RAfz7cJ 5aTE3M88l5olT6zeiNc+zFSfmhHN1HVAR7OO28oMVvnAdO/d1+GY5/aIdSsm/pMOEjdc j4xA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=V4rZaRl+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id x3si7607874eds.522.2020.11.09.05.24.47; Mon, 09 Nov 2020 05:25:10 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=V4rZaRl+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387735AbgKINXb (ORCPT + 99 others); Mon, 9 Nov 2020 08:23:31 -0500 Received: from mail.kernel.org ([198.145.29.99]:48468 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387481AbgKINUs (ORCPT ); Mon, 9 Nov 2020 08:20:48 -0500 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (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 8C3D520663; Mon, 9 Nov 2020 13:20:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604928048; bh=wGp0qCVkWFciBTIMbfHPkFztMdbRDh0g09EpCcra3Ek=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=V4rZaRl++7t9a/OIn4dNhVJnR+klCKN+CePf8vWb+iuEwpjhFzItvCQfyVQSuHvvz 2SM3XAUUbsjtVjgI9+YlZCZvtXFlV0t2o0+EuTQEQaIn4TXrHG/8cY0RfzqRPXSbnf 8nmsc7H0UmesGXSAlwqk31TtPCcY/kfLvMzHc7RI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Niklas Schnelle , Pierre Morel , Heiko Carstens Subject: [PATCH 5.9 110/133] s390/pci: fix hot-plug of PCI function missing bus Date: Mon, 9 Nov 2020 13:56:12 +0100 Message-Id: <20201109125035.979739429@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201109125030.706496283@linuxfoundation.org> References: <20201109125030.706496283@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Niklas Schnelle commit 0b2ca2c7d0c9e2731d01b6c862375d44a7e13923 upstream. Under some circumstances in particular with "Reconfigure I/O Path" a zPCI function may first appear in Standby through a PCI event with PEC 0x0302 which initially makes it visible to the zPCI subsystem, Only after that is it configured with a zPCI event with PEC 0x0301. If the zbus is still missing a PCI function zero (devfn == 0) when the PCI event 0x0301 is handled zdev->zbus->bus is still NULL and gets dereferenced in common code. Check for this case and enable but don't scan the zPCI function. This matches what would happen if we immediately got the 0x0301 configuration request or the function was included in CLP List PCI. In all cases the PCI functions with devfn != 0 will be scanned once function 0 appears. Fixes: 3047766bc6ec ("s390/pci: fix enabling a reserved PCI function") Cc: # 5.8 Signed-off-by: Niklas Schnelle Acked-by: Pierre Morel Signed-off-by: Heiko Carstens Signed-off-by: Greg Kroah-Hartman --- arch/s390/pci/pci_event.c | 4 ++++ 1 file changed, 4 insertions(+) --- a/arch/s390/pci/pci_event.c +++ b/arch/s390/pci/pci_event.c @@ -101,6 +101,10 @@ static void __zpci_event_availability(st if (ret) break; + /* the PCI function will be scanned once function 0 appears */ + if (!zdev->zbus->bus) + break; + pdev = pci_scan_single_device(zdev->zbus->bus, zdev->devfn); if (!pdev) break;