All of lore.kernel.org
 help / color / mirror / Atom feed
From: Julien Grall <julien@xen.org>
To: xen-devel@lists.xenproject.org
Cc: julien@xen.org, Julien Grall <jgrall@amazon.com>,
	Stefano Stabellini <sstabellini@kernel.org>
Subject: [PATCH] xen/iommu: dt: Check the return value of xsm_deassign_dtdevice()
Date: Sun, 22 May 2022 17:59:00 +0100	[thread overview]
Message-ID: <20220522165900.83104-1-julien@xen.org> (raw)

From: Julien Grall <jgrall@amazon.com>

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")
Signed-off-by: Julien Grall <jgrall@amazon.com>

---

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(+)

diff --git a/xen/drivers/passthrough/device_tree.c b/xen/drivers/passthrough/device_tree.c
index 98f2aa0dad68..1c32d7b50cce 100644
--- a/xen/drivers/passthrough/device_tree.c
+++ b/xen/drivers/passthrough/device_tree.c
@@ -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;
-- 
2.32.0



             reply	other threads:[~2022-05-22 16:59 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-22 16:59 Julien Grall [this message]
2022-05-23  7:00 ` [PATCH] xen/iommu: dt: Check the return value of xsm_deassign_dtdevice() Michal Orzel
2022-05-23 20:01   ` Julien Grall
2022-05-24  7:54 ` Bertrand Marquis
2022-05-25  8:53   ` Julien Grall

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220522165900.83104-1-julien@xen.org \
    --to=julien@xen.org \
    --cc=jgrall@amazon.com \
    --cc=sstabellini@kernel.org \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.