From: Will Deacon <will.deacon@arm.com>
To: Robin Murphy <robin.murphy@arm.com>
Cc: Artem Savkov <asavkov@redhat.com>,
iommu@lists.linux-foundation.org,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, joro@8bytes.org
Subject: Re: [PATCH v2] iommu/arm-smmu: fix null-pointer dereference in arm_smmu_add_device
Date: Tue, 8 Aug 2017 12:21:44 +0100 [thread overview]
Message-ID: <20170808112144.GE13355@arm.com> (raw)
In-Reply-To: <d7a07e48-862d-a6f7-8bad-9c71f5a5be5b@arm.com>
[+ Joerg]
On Tue, Aug 08, 2017 at 11:37:40AM +0100, Robin Murphy wrote:
> On 08/08/17 11:26, Artem Savkov wrote:
> > Commit c54451a "iommu/arm-smmu: Fix the error path in arm_smmu_add_device"
> > removed fwspec assignment in legacy_binding path as redundant which is
> > wrong. It needs to be updated after fwspec initialisation in
> > arm_smmu_register_legacy_master() as it is dereferenced later. Without
> > this there is a NULL-pointer dereference panic during boot on some hosts.
>
> Reviewed-by: Robin Murphy <robin.murphy@arm.com>
>
> Thanks for fixing it up, and sorry for failing to document the
> unfortunately subtle logic in the first place!
Well, I was the one that messed it up:
Acked-by: Will Deacon <will.deacon@arm.com>
Joerg, can you pick this up as a fix for 4.13, please?
Will
> > Signed-off-by: Artem Savkov <asavkov@redhat.com>
> > ---
> > drivers/iommu/arm-smmu.c | 7 +++++++
> > 1 file changed, 7 insertions(+)
> >
> > diff --git a/drivers/iommu/arm-smmu.c b/drivers/iommu/arm-smmu.c
> > index b97188a..2d80fa8 100644
> > --- a/drivers/iommu/arm-smmu.c
> > +++ b/drivers/iommu/arm-smmu.c
> > @@ -1519,6 +1519,13 @@ static int arm_smmu_add_device(struct device *dev)
> >
> > if (using_legacy_binding) {
> > ret = arm_smmu_register_legacy_master(dev, &smmu);
> > +
> > + /*
> > + * If dev->iommu_fwspec is initally NULL, arm_smmu_register_legacy_master()
> > + * will allocate/initialise a new one. Thus we need to update fwspec for
> > + * later use.
> > + */
> > + fwspec = dev->iommu_fwspec;
> > if (ret)
> > goto out_free;
> > } else if (fwspec && fwspec->ops == &arm_smmu_ops) {
> >
>
next prev parent reply other threads:[~2017-08-08 11:21 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-08 8:58 [PATCH] iommu/arm-smmu: fix null-pointer dereference in arm_smmu_add_device Artem Savkov
2017-08-08 9:26 ` Will Deacon
2017-08-08 10:26 ` [PATCH v2] " Artem Savkov
2017-08-08 10:37 ` Robin Murphy
2017-08-08 11:21 ` Will Deacon [this message]
[not found] ` <20170808112144.GE13355-5wv7dgnIgG8@public.gmane.org>
2017-08-09 21:41 ` David Daney
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=20170808112144.GE13355@arm.com \
--to=will.deacon@arm.com \
--cc=asavkov@redhat.com \
--cc=iommu@lists.linux-foundation.org \
--cc=joro@8bytes.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=robin.murphy@arm.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).