mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/herbert/cryptodev-2.6.git
synced 2026-04-04 04:37:39 -04:00
uio: pci_sva: correct '-ENODEV' check logic
The current '-ENODEV' check uses '&&', which can lead to a NULL pointer
dereference when udev is NULL.
Fix the condition to return -ENODEV if either udev or its pdev is NULL.
Fixes: 3397c3cd85 ("uio: Add SVA support for PCI devices via uio_pci_generic_sva.c")
Signed-off-by: Haiyue Wang <haiyuewa@163.com>
Link: https://patch.msgid.link/20260109175448.34309-1-haiyuewa@163.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
26c08dabe5
commit
054e1c0e61
@@ -29,7 +29,7 @@ static int uio_pci_sva_open(struct uio_info *info, struct inode *inode)
|
||||
struct uio_pci_sva_dev *udev = info->priv;
|
||||
struct iommu_domain *domain;
|
||||
|
||||
if (!udev && !udev->pdev)
|
||||
if (!udev || !udev->pdev)
|
||||
return -ENODEV;
|
||||
|
||||
domain = iommu_get_domain_for_dev(&udev->pdev->dev);
|
||||
@@ -51,7 +51,7 @@ static int uio_pci_sva_release(struct uio_info *info, struct inode *inode)
|
||||
{
|
||||
struct uio_pci_sva_dev *udev = info->priv;
|
||||
|
||||
if (!udev && !udev->pdev)
|
||||
if (!udev || !udev->pdev)
|
||||
return -ENODEV;
|
||||
|
||||
iommu_sva_unbind_device(udev->sva_handle);
|
||||
|
||||
Reference in New Issue
Block a user