From: Laurent Pinchart <laurent.pinchart-ryLnwIuWjnjg/C1BVhZhaw@public.gmane.org>
To: Marek Szyprowski <m.szyprowski-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
Cc: "mp.vikram-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org"
<mp.vikram-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
Catalin Marinas <Catalin.Marinas-5wv7dgnIgG8@public.gmane.org>,
Will Deacon <will.deacon-5wv7dgnIgG8@public.gmane.org>,
"menon.vinayak-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org"
<menon.vinayak-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
"iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org"
<iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org>,
"linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org"
<linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org>,
"rmk-lFZ/pmaqli7XmaaqVzeoHQ@public.gmane.org"
<rmk-lFZ/pmaqli7XmaaqVzeoHQ@public.gmane.org>
Subject: Re: [PATCH] arm: dma-mapping: Fix mapping size value
Date: Wed, 23 Apr 2014 11:30:53 +0200 [thread overview]
Message-ID: <4662711.Ubz0jaKMvq@avalon> (raw)
In-Reply-To: <53577F84.1080101-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
Hi Marek,
On Wednesday 23 April 2014 10:53:24 Marek Szyprowski wrote:
> On 2014-04-22 10:53, Will Deacon wrote:
> > On Mon, Apr 21, 2014 at 07:47:27AM +0100, Ritesh Harjani wrote:
> > > 68efd7d2fb("arm: dma-mapping: remove order parameter from
> > > arm_iommu_create_mapping()") is causing kernel panic
> > > because it wrongly sets the value of mapping->size:
> > >
> > > Unable to handle kernel NULL pointer dereference at virtual
> > > address 000000a0
> > > pgd = e7a84000
> > > [000000a0] *pgd=00000000
> > > ...
> > > PC is at bitmap_clear+0x48/0xd0
> > > LR is at __iommu_remove_mapping+0x130/0x164
> > >
> > > Fix it by correcting mapping->size value.
> > >
> > > Signed-off-by: Ritesh Harjani <ritesh.harjani-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
> > > Acked-by: Laurent Pinchart <laurent.pinchart-ryLnwIuWjnjg/C1BVhZhaw@public.gmane.org>
> > > ---
> > >
> > > arch/arm/mm/dma-mapping.c | 2 +-
> > > 1 file changed, 1 insertion(+), 1 deletion(-)
> > >
> > > diff --git a/arch/arm/mm/dma-mapping.c b/arch/arm/mm/dma-mapping.c
> > > index f62aa06..6b00be1 100644
> > > --- a/arch/arm/mm/dma-mapping.c
> > > +++ b/arch/arm/mm/dma-mapping.c
> > > @@ -1963,8 +1963,8 @@ arm_iommu_create_mapping(struct bus_type *bus,
> > > dma_addr_t base, size_t size)> >
> > > mapping->nr_bitmaps = 1;
> > > mapping->extensions = extensions;
> > > mapping->base = base;
> > >
> > > - mapping->size = bitmap_size << PAGE_SHIFT;
> > >
> > > mapping->bits = BITS_PER_BYTE * bitmap_size;
> > >
> > > + mapping->size = mapping->bits << PAGE_SHIFT;
> >
> > Ok, but given that mapping->size is derived from mapping->bits, do we
> > really need both of these fields in struct dma_iommu_mapping?
>
> You are right. I didn't notice this while I was refactoring the code.
> Ritesh, could you update your patch and simply replace all references of
> mapping->size with (mapping->bits << PAGE_SHIFT), probably with some
> temporary variable to make the code easier to understand? I've didn't apply
> your patch yet.
As this patch fixes a v3.15 regression, shouldn't it be applied as-is and
ASAP, with the cleanup that removes mapping->size coming in a later, less
urgent patch ?
--
Regards,
Laurent Pinchart
WARNING: multiple messages have this Message-ID (diff)
From: laurent.pinchart@ideasonboard.com (Laurent Pinchart)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] arm: dma-mapping: Fix mapping size value
Date: Wed, 23 Apr 2014 11:30:53 +0200 [thread overview]
Message-ID: <4662711.Ubz0jaKMvq@avalon> (raw)
In-Reply-To: <53577F84.1080101@samsung.com>
Hi Marek,
On Wednesday 23 April 2014 10:53:24 Marek Szyprowski wrote:
> On 2014-04-22 10:53, Will Deacon wrote:
> > On Mon, Apr 21, 2014 at 07:47:27AM +0100, Ritesh Harjani wrote:
> > > 68efd7d2fb("arm: dma-mapping: remove order parameter from
> > > arm_iommu_create_mapping()") is causing kernel panic
> > > because it wrongly sets the value of mapping->size:
> > >
> > > Unable to handle kernel NULL pointer dereference at virtual
> > > address 000000a0
> > > pgd = e7a84000
> > > [000000a0] *pgd=00000000
> > > ...
> > > PC is at bitmap_clear+0x48/0xd0
> > > LR is at __iommu_remove_mapping+0x130/0x164
> > >
> > > Fix it by correcting mapping->size value.
> > >
> > > Signed-off-by: Ritesh Harjani <ritesh.harjani@gmail.com>
> > > Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> > > ---
> > >
> > > arch/arm/mm/dma-mapping.c | 2 +-
> > > 1 file changed, 1 insertion(+), 1 deletion(-)
> > >
> > > diff --git a/arch/arm/mm/dma-mapping.c b/arch/arm/mm/dma-mapping.c
> > > index f62aa06..6b00be1 100644
> > > --- a/arch/arm/mm/dma-mapping.c
> > > +++ b/arch/arm/mm/dma-mapping.c
> > > @@ -1963,8 +1963,8 @@ arm_iommu_create_mapping(struct bus_type *bus,
> > > dma_addr_t base, size_t size)> >
> > > mapping->nr_bitmaps = 1;
> > > mapping->extensions = extensions;
> > > mapping->base = base;
> > >
> > > - mapping->size = bitmap_size << PAGE_SHIFT;
> > >
> > > mapping->bits = BITS_PER_BYTE * bitmap_size;
> > >
> > > + mapping->size = mapping->bits << PAGE_SHIFT;
> >
> > Ok, but given that mapping->size is derived from mapping->bits, do we
> > really need both of these fields in struct dma_iommu_mapping?
>
> You are right. I didn't notice this while I was refactoring the code.
> Ritesh, could you update your patch and simply replace all references of
> mapping->size with (mapping->bits << PAGE_SHIFT), probably with some
> temporary variable to make the code easier to understand? I've didn't apply
> your patch yet.
As this patch fixes a v3.15 regression, shouldn't it be applied as-is and
ASAP, with the cleanup that removes mapping->size coming in a later, less
urgent patch ?
--
Regards,
Laurent Pinchart
next prev parent reply other threads:[~2014-04-23 9:30 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-04-21 6:47 [PATCH RESEND] arm: dma-mapping: Fix mapping size value Ritesh Harjani
2014-04-21 6:47 ` Ritesh Harjani
[not found] ` <1398062847-5770-1-git-send-email-ritesh.harjani-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2014-04-21 6:47 ` [PATCH] " Ritesh Harjani
2014-04-21 6:47 ` Ritesh Harjani
[not found] ` <1398062847-5770-2-git-send-email-ritesh.harjani-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2014-04-22 8:53 ` Will Deacon
2014-04-22 8:53 ` Will Deacon
[not found] ` <20140422085307.GB5747-5wv7dgnIgG8@public.gmane.org>
2014-04-23 8:53 ` Marek Szyprowski
2014-04-23 8:53 ` Marek Szyprowski
[not found] ` <53577F84.1080101-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2014-04-23 9:30 ` Laurent Pinchart [this message]
2014-04-23 9:30 ` Laurent Pinchart
2014-04-23 10:04 ` Ritesh Harjani
2014-04-23 10:04 ` Ritesh Harjani
[not found] ` <CAD15agYETzLJZ26wh8c=+PCSoQ9dR9vLgg7VmZTnQquXxoW+2Q-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-04-23 13:17 ` Marek Szyprowski
2014-04-23 13:17 ` Marek Szyprowski
[not found] ` <5357BD77.3060908-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2014-04-23 13:22 ` Ritesh Harjani
2014-04-23 13:22 ` Ritesh Harjani
2014-04-22 9:09 ` Marek Szyprowski
2014-04-22 9:09 ` Marek Szyprowski
-- strict thread matches above, loose matches on Subject: below --
2014-04-21 4:01 Ritesh Harjani
[not found] ` <CAD15agZwxTQOBZtJCmAkbBW6hXGfRgedSc_Fi_-nHOE5MeAjTw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-04-21 9:53 ` Laurent Pinchart
2014-04-21 9:53 ` Laurent Pinchart
2014-04-21 12:25 ` Laurent Pinchart
2014-04-21 12:25 ` Laurent Pinchart
2014-04-19 11:19 Ritesh Harjani
2014-04-19 11:19 ` Ritesh Harjani
[not found] ` <CAD15aga8DTuzYrPfHF3X=ZvCuCQxfx1nOTk90DdwdxeZvV5tdA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-04-19 11:25 ` Ritesh Harjani
2014-04-19 11:25 ` Ritesh Harjani
[not found] ` <CAD15agbgOhK2b4WaWM4g45iiT7yH8HPYu=GmsOs7BkCnVvjcsw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-04-20 22:36 ` Laurent Pinchart
2014-04-20 22:36 ` Laurent Pinchart
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=4662711.Ubz0jaKMvq@avalon \
--to=laurent.pinchart-rylnwiuwjnjg/c1bvhzhaw@public.gmane.org \
--cc=Catalin.Marinas-5wv7dgnIgG8@public.gmane.org \
--cc=iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org \
--cc=linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
--cc=m.szyprowski-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org \
--cc=menon.vinayak-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=mp.vikram-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=rmk-lFZ/pmaqli7XmaaqVzeoHQ@public.gmane.org \
--cc=will.deacon-5wv7dgnIgG8@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.