lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87ftoldh48.fsf@linux.intel.com>
Date:   Fri, 07 Jun 2019 09:49:59 +0300
From:   Felipe Balbi <balbi@...nel.org>
To:     Anurag Kumar Vulisha <anuragku@...inx.com>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc:     "linux-usb\@vger.kernel.org" <linux-usb@...r.kernel.org>,
        "linux-kernel\@vger.kernel.org" <linux-kernel@...r.kernel.org>,
        "v.anuragkumar\@gmail.com" <v.anuragkumar@...il.com>
Subject: RE: [PATCH] usb: dwc3: gadget: Correct the logic for finding last SG entry


Hi,

Anurag Kumar Vulisha <anuragku@...inx.com> writes:
>>> The dma_map_sg() merges sg1 & sg2 memory regions into sg1-
>>>dma_address.
>>> Similarly sg3 & sg4 into sg2->dma_address, sg5 & sg6 into the
>>> sg3->dma_address and sg6 & sg8 into sg4->dma_address. Here the
>>memory
>>> regions are merged but the page_link properties like SG_END are not
>>> retained into the merged sgs.
>>
>>isn't this a bug in the scatterlist mapping code? Why doesn't it keep
>>SG_END?
>>
>
> Thanks for providing your comment.
>
> I don't think it is a bug, instead I feel some enhancement needs to be done in
> dma-mapping code.
>
> SG_END represents the last sg entry in the sglist and it is correctly getting
> set to the last sg entry.
>
> The issue happens only when 2 or more sg entry pages are merged into
> contiguous dma-able address and sg_is_last() is used to find the last sg entry
> with valid dma address.

Right, and that's something that's bound to happen. I'm arguing that, perhaps,
dma API should move SG_END in case entries are merged.

> I think that along with sg_is_last() a new flag (SG_DMA_END) and function
> (something like sg_dma_is_last() ) needs to be added into dma-mapping code for
> identifying the last valid sg entry with valid dma address. So that we can
> make use of that function instead of sg_is_last().

Sure, propose a patch to DMA API.

-- 
balbi

Download attachment "signature.asc" of type "application/pgp-signature" (833 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ