From: Laurent Pinchart <laurent.pinchart-ryLnwIuWjnjg/C1BVhZhaw@public.gmane.org>
To: Suman Anna <s-anna-l0cyMroinI0@public.gmane.org>
Cc: linux-omap-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org,
Florian Vaussard <florian.vaussard-p8DiymsW2f8@public.gmane.org>
Subject: Re: [PATCHv2 1/2] iommu/omap: Check for valid archdata in attach_dev
Date: Fri, 05 Sep 2014 14:12:34 +0300 [thread overview]
Message-ID: <2089748.loWtuY0IUs@avalon> (raw)
In-Reply-To: <1409869650-26115-2-git-send-email-s-anna-l0cyMroinI0@public.gmane.org>
Hi Suman,
Thank you for the patch.
On Thursday 04 September 2014 17:27:29 Suman Anna wrote:
> Any device requiring to be attached to an iommu_domain must have
> valid archdata containing the necessary iommu information, which
> is SoC-specific. Add a check in the omap_iommu_attach_dev to make
> sure that the device has valid archdata before accessing
> different SoC-specific fields of the archdata. This prevents a
> NULL pointer dereference on any misconfigured devices.
>
> Signed-off-by: Suman Anna <s-anna-l0cyMroinI0@public.gmane.org>
Acked-by: Laurent Pinchart <laurent.pinchart-ryLnwIuWjnjg/C1BVhZhaw@public.gmane.org>
> ---
> drivers/iommu/omap-iommu.c | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/drivers/iommu/omap-iommu.c b/drivers/iommu/omap-iommu.c
> index 02ef0ac..ea6e59d 100644
> --- a/drivers/iommu/omap-iommu.c
> +++ b/drivers/iommu/omap-iommu.c
> @@ -1090,6 +1090,11 @@ omap_iommu_attach_dev(struct iommu_domain *domain,
> struct device *dev) struct omap_iommu_arch_data *arch_data =
> dev->archdata.iommu;
> int ret = 0;
>
> + if (!arch_data || !arch_data->name) {
> + dev_err(dev, "device doesn't have an associated iommu\n");
> + return -EINVAL;
> + }
> +
> spin_lock(&omap_domain->lock);
>
> /* only a single device is supported per domain for now */
--
Regards,
Laurent Pinchart
next prev parent reply other threads:[~2014-09-05 11:12 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-09-04 22:27 [PATCHv2 0/2] OMAP IOMMU Fixes for DT-clients Suman Anna
2014-09-04 22:27 ` [PATCHv2 2/2] iommu/omap: Fix iommu archdata name for DT-based devices Suman Anna
[not found] ` <1409869650-26115-3-git-send-email-s-anna-l0cyMroinI0@public.gmane.org>
2014-09-05 11:13 ` Laurent Pinchart
[not found] ` <1409869650-26115-1-git-send-email-s-anna-l0cyMroinI0@public.gmane.org>
2014-09-04 22:27 ` [PATCHv2 1/2] iommu/omap: Check for valid archdata in attach_dev Suman Anna
[not found] ` <1409869650-26115-2-git-send-email-s-anna-l0cyMroinI0@public.gmane.org>
2014-09-05 11:12 ` Laurent Pinchart [this message]
2014-09-05 13:31 ` [PATCHv2 0/2] OMAP IOMMU Fixes for DT-clients Joerg Roedel
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=2089748.loWtuY0IUs@avalon \
--to=laurent.pinchart-rylnwiuwjnjg/c1bvhzhaw@public.gmane.org \
--cc=florian.vaussard-p8DiymsW2f8@public.gmane.org \
--cc=iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org \
--cc=linux-omap-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=s-anna-l0cyMroinI0@public.gmane.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.