linux-stable/drivers/pci/switch
Bjorn Helgaas ec4b595572 PCI: switchtec: Return -EFAULT for copy_to_user() errors
[ Upstream commit ddc10938e0 ]

switchtec_dev_read() didn't handle copy_to_user() errors correctly: it
assigned "rc = -EFAULT", but actually returned either "size", -ENXIO, or
-EBADMSG instead.

Update the failure cases to unlock mrpc_mutex and return -EFAULT directly.

Link: https://lore.kernel.org/r/20221216162126.207863-3-helgaas@kernel.org
Fixes: 080b47def5 ("MicroSemi Switchtec management interface driver")
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Reviewed-by: Logan Gunthorpe <logang@deltatee.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2023-03-10 09:28:49 +01:00
..
Kconfig docs: driver-api: add a series of orphaned documents 2019-07-15 11:03:02 -03:00
Makefile PCI: Add SPDX GPL-2.0 when no license was specified 2018-01-26 11:45:16 -06:00
switchtec.c PCI: switchtec: Return -EFAULT for copy_to_user() errors 2023-03-10 09:28:49 +01:00