Skip to contentSkip to conversation

xen/iommu: dt: Check the return value of xsm_deassign_dtdevice()

PATCH In review Julien Grall 3 participants 5 messages May 22, 2022 – May 25, 2022

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xen/iommu: dt: Check the return value of xsm_deassign_dtdevice()

From: Julien Grall <[email protected]>

xsm_deasign_dtdevice() will indicate whether the caller is allowed to issue the operation. So the return value has to be checked.

Spotted by clang static analyzer.

Fixes fe36cccc483c ("xen/passthrough: Extend XEN_DOMCTL_*assign_device to support DT device")

---

Platform device-passthrough is not security supported. Hence why this is sent directly to xen-devel.

---
 xen/drivers/passthrough/device_tree.c | 2 ++
 1 file changed, 2 insertions(+)
xen/drivers/passthrough/device_tree.c +2 -0
index 98f2aa0dad68..1c32d7b50cce 100644
@@ -269,6 +269,8 @@ int iommu_do_dt_domctl(struct xen_domctl *domctl, struct domain *d,
             break;
 
         ret = xsm_deassign_dtdevice(XSM_HOOK, d, dt_node_full_name(dev));
+        if ( ret )
+            break;
 
         if ( d == dom_io )
             return -EINVAL;
Signature · 1 line
2.32.0
Reviewed-by on v1 1/1
#1 lore raw

Hi Julien,

Quoted 3 lines · Julien Grall

From: Julien Grall <[email protected]>

xsm_deasign_dtdevice() will indicate whether the caller is allowed

s/deasign/deassign/

Quoted 6 lines

to issue the operation. So the return value has to be checked.

Spotted by clang static analyzer.

Fixes fe36cccc483c ("xen/passthrough: Extend XEN_DOMCTL_*assign_device to support DT device")

Apart from that:

#2 lore raw
Quoted 1 line · Michal Orzel

Hi Julien,

Hi Michal,

Quoted 5 lines · Julien Grall
Quoted 3 lines

From: Julien Grall <[email protected]>

xsm_deasign_dtdevice() will indicate whether the caller is allowed

s/deasign/deassign/

Good spot! I will fix it on commit unless there are any objections.

Quoted 10 lines
Quoted 7 lines

to issue the operation. So the return value has to be checked.

Spotted by clang static analyzer.

Fixes fe36cccc483c ("xen/passthrough: Extend XEN_DOMCTL_*assign_device to support DT device")

Apart from that:

Thanks!

Cheers,

Signature · 1 line
Julien Grall
Reviewed-by on v1 1/1
#3 lore raw
In reply to Julien Grall

Hi Julien,

Quoted 11 lines · Julien Grall

From: Julien Grall <[email protected]>

xsm_deasign_dtdevice() will indicate whether the caller is allowed to issue the operation. So the return value has to be checked.

Spotted by clang static analyzer.

Fixes fe36cccc483c ("xen/passthrough: Extend XEN_DOMCTL_*assign_device to support DT device")

With the typo spotted by Michal solved (can be done on commit):

Cheers
Bertrand

Quoted 26 lines

---

Platform device-passthrough is not security supported. Hence why this is sent directly to xen-devel.
---
xen/drivers/passthrough/device_tree.c | 2 ++

1 file changed, 2 insertions(+)
xen/drivers/passthrough/device_tree.c +2 -0
index 98f2aa0dad68..1c32d7b50cce 100644
@@ -269,6 +269,8 @@ int iommu_do_dt_domctl(struct xen_domctl *domctl, struct domain *d,
            break;
 
        ret = xsm_deassign_dtdevice(XSM_HOOK, d, dt_node_full_name(dev));
+        if ( ret )
+            break;
 
        if ( d == dom_io )
            return -EINVAL;
Signature · 1 line
2.32.0
#4 lore raw
Quoted 1 line · Bertrand Marquis

Hi Julien,

Hi Bertrand,

Quoted 7 lines
Quoted 7 lines · Julien Grall

From: Julien Grall <[email protected]>

xsm_deasign_dtdevice() will indicate whether the caller is allowed to issue the operation. So the return value has to be checked.

Quoted 7 lines
Quoted 4 lines

Spotted by clang static analyzer.

Fixes fe36cccc483c ("xen/passthrough: Extend XEN_DOMCTL_*assign_device to support DT device")

With the typo spotted by Michal solved (can be done on commit):

I fixed the typo and committed.

Cheers,

Signature · 1 line
Julien Grall