From: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
To: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Cc: linux-ide@vger.kernel.org
Subject: Re: [PATCH] fix dma_unmap_sg misuse
Date: Thu, 19 Feb 2009 17:06:46 +0100 [thread overview]
Message-ID: <200902191706.46661.bzolnier@gmail.com> (raw)
In-Reply-To: <20090219220401T.fujita.tomonori@lab.ntt.co.jp>
On Thursday 19 February 2009, FUJITA Tomonori wrote:
> On Wed, 18 Feb 2009 21:59:49 +0100
> Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> wrote:
>
> > On Tuesday 17 February 2009, FUJITA Tomonori wrote:
> > > Looks like that libata misuses dma_unmap_sg though I'm not familiar
> > > with libata so I might completely misunderstand something.
> > >
> > > =
> > > From: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
> > > Subject: [PATCH] fix dma_unmap_sg misuse
> > >
> > > DMA-mapping.txt says:
> > >
> > > To unmap a scatterlist, just call:
> > >
> > > pci_unmap_sg(pdev, sglist, nents, direction);
> > >
> > > Again, make sure DMA activity has already finished.
> > >
> > > PLEASE NOTE: The 'nents' argument to the pci_unmap_sg call must be
> > > the _same_ one you passed into the pci_map_sg call,
> > > it should _NOT_ be the 'count' value _returned_ from the
> > > pci_map_sg call.
> >
> > This is correct and other subsystems (SCSI, IDE) are compliant with it.
> >
> > > Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
> >
> > Acked-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
>
> Thanks,
>
> I guess that the ide stack has the same problem (I guess that you
> already knew that though).
>
> Looks like that the ide stack in linux-next has more serious problem
> about handling dma_map_sg?
>
> In linux-next, the ide doesn't save the returned value of dma_map_sg
> and assumes that dma_map_sg returns the same value to the 'nents'
> argument of dma_map_sg?
>
> Again I'm not familiar with the ide stack at all so I might completely
> misunderstand something.
>
> =
> From: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
> Date: Thu, 19 Feb 2009 21:51:17 +0900
> Subject: [PATCH] ide: save the returned value of dma_map_sg
>
> dma_map_sg could return a value different to 'nents' argument of
> dma_map_sg so the ide stack needs to save it for the later usage
> (e.g. for_each_sg).
>
> The ide stack also needs to save the original sg_nents value for
> pci_unmap_sg.
>
> Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
applied, thanks!
next prev parent reply other threads:[~2009-02-19 17:21 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-02-17 4:35 [PATCH] fix dma_unmap_sg misuse FUJITA Tomonori
2009-02-18 20:59 ` Bartlomiej Zolnierkiewicz
2009-02-19 13:04 ` FUJITA Tomonori
2009-02-19 16:06 ` Bartlomiej Zolnierkiewicz [this message]
2009-02-18 22:12 ` Chuck Ebbert
2009-02-19 13:09 ` FUJITA Tomonori
2009-02-19 9:03 ` Tejun Heo
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=200902191706.46661.bzolnier@gmail.com \
--to=bzolnier@gmail.com \
--cc=fujita.tomonori@lab.ntt.co.jp \
--cc=linux-ide@vger.kernel.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.