public inbox for stable@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH AUTOSEL 4.19 01/16] iommu/amd: Fix error handling for pdev_pri_ats_enable()
@ 2023-03-03 21:48 Sasha Levin
  2023-03-03 21:48 ` [PATCH AUTOSEL 4.19 02/16] media: uvcvideo: Handle cameras with invalid descriptors Sasha Levin
                   ` (14 more replies)
  0 siblings, 15 replies; 16+ messages in thread
From: Sasha Levin @ 2023-03-03 21:48 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Vasant Hegde, Matt Fagnani, Suravee Suthikulpanit, Joerg Roedel,
	Sasha Levin, joro, will, iommu

From: Vasant Hegde <vasant.hegde@amd.com>

[ Upstream commit 080920e52148b4fbbf9360d5345fdcd7846e4841 ]

Current code throws kernel warning if it fails to enable pasid/pri [1].
Do not call pci_disable_[pasid/pri] if pci_enable_[pasid/pri] failed.

[1] https://lore.kernel.org/linux-iommu/15d0f9ff-2a56-b3e9-5b45-e6b23300ae3b@leemhuis.info/

Reported-by: Matt Fagnani <matt.fagnani@bell.net>
Signed-off-by: Vasant Hegde <vasant.hegde@amd.com>
Reviewed-by: Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>
Link: https://lore.kernel.org/r/20230111121503.5931-1-vasant.hegde@amd.com
Signed-off-by: Joerg Roedel <jroedel@suse.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/iommu/amd_iommu.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/drivers/iommu/amd_iommu.c b/drivers/iommu/amd_iommu.c
index 5d5941aca16ad..75c5932d0133a 100644
--- a/drivers/iommu/amd_iommu.c
+++ b/drivers/iommu/amd_iommu.c
@@ -2059,17 +2059,17 @@ static int pdev_iommuv2_enable(struct pci_dev *pdev)
 	/* Only allow access to user-accessible pages */
 	ret = pci_enable_pasid(pdev, 0);
 	if (ret)
-		goto out_err;
+		return ret;
 
 	/* First reset the PRI state of the device */
 	ret = pci_reset_pri(pdev);
 	if (ret)
-		goto out_err;
+		goto out_err_pasid;
 
 	/* Enable PRI */
 	ret = pci_enable_pri(pdev, reqs);
 	if (ret)
-		goto out_err;
+		goto out_err_pasid;
 
 	if (reset_enable) {
 		ret = pri_reset_while_enabled(pdev);
@@ -2079,12 +2079,14 @@ static int pdev_iommuv2_enable(struct pci_dev *pdev)
 
 	ret = pci_enable_ats(pdev, PAGE_SHIFT);
 	if (ret)
-		goto out_err;
+		goto out_err_pri;
 
 	return 0;
 
-out_err:
+out_err_pri:
 	pci_disable_pri(pdev);
+
+out_err_pasid:
 	pci_disable_pasid(pdev);
 
 	return ret;
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2023-03-03 22:55 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-03-03 21:48 [PATCH AUTOSEL 4.19 01/16] iommu/amd: Fix error handling for pdev_pri_ats_enable() Sasha Levin
2023-03-03 21:48 ` [PATCH AUTOSEL 4.19 02/16] media: uvcvideo: Handle cameras with invalid descriptors Sasha Levin
2023-03-03 21:48 ` [PATCH AUTOSEL 4.19 03/16] media: uvcvideo: Handle errors from calls to usb_string Sasha Levin
2023-03-03 21:48 ` [PATCH AUTOSEL 4.19 04/16] media: uvcvideo: Silence memcpy() run-time false positive warnings Sasha Levin
2023-03-03 21:48 ` [PATCH AUTOSEL 4.19 05/16] tty: fix out-of-bounds access in tty_driver_lookup_tty() Sasha Levin
2023-03-03 21:48 ` [PATCH AUTOSEL 4.19 06/16] tty: serial: fsl_lpuart: disable the CTS when send break signal Sasha Levin
2023-03-03 21:48 ` [PATCH AUTOSEL 4.19 07/16] mei: bus-fixup:upon error print return values of send and receive Sasha Levin
2023-03-03 21:48 ` [PATCH AUTOSEL 4.19 08/16] parport_pc: Set up mode and ECR masks for Oxford Semiconductor devices Sasha Levin
2023-03-03 21:48 ` [PATCH AUTOSEL 4.19 09/16] tools/iio/iio_utils:fix memory leak Sasha Levin
2023-03-03 21:48 ` [PATCH AUTOSEL 4.19 10/16] iio: accel: mma9551_core: Prevent uninitialized variable in mma9551_read_status_word() Sasha Levin
2023-03-03 21:48 ` [PATCH AUTOSEL 4.19 11/16] iio: accel: mma9551_core: Prevent uninitialized variable in mma9551_read_config_word() Sasha Levin
2023-03-03 21:48 ` [PATCH AUTOSEL 4.19 12/16] firmware: coreboot: framebuffer: Ignore reserved pixel color bits Sasha Levin
2023-03-03 21:48 ` [PATCH AUTOSEL 4.19 13/16] usb: host: xhci: mvebu: Iterate over array indexes instead of using pointer math Sasha Levin
2023-03-03 21:48 ` [PATCH AUTOSEL 4.19 14/16] USB: ene_usb6250: Allocate enough memory for full object Sasha Levin
2023-03-03 21:48 ` [PATCH AUTOSEL 4.19 15/16] usb: uvc: Enumerate valid values for color matching Sasha Levin
2023-03-03 21:48 ` [PATCH AUTOSEL 4.19 16/16] phy: rockchip-typec: Fix unsigned comparison with less than zero Sasha Levin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox