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: <c1ca8d84-ec5d-b247-0338-f1b7b96999d8@axentia.se>
Date:   Mon, 12 Jun 2017 12:19:48 +0200
From:   Peter Rosin <peda@...ntia.se>
To:     Andy Shevchenko <andy.shevchenko@...il.com>
Cc:     Song liwei <liwei.song@...driver.com>,
        Wolfram Sang <wsa@...-dreams.de>,
        Seth Heasley <seth.heasley@...el.com>,
        Neil Horman <nhorman@...driver.com>,
        linux-i2c <linux-i2c@...r.kernel.org>,
        linux-kernel <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] i2c: ismt: fix wrong device address when unmap the data
 buffer

On 2017-06-12 11:38, Andy Shevchenko wrote:
> On Mon, Jun 12, 2017 at 12:28 PM, Peter Rosin <peda@...ntia.se> wrote:
>> On 2017-06-12 11:11, Andy Shevchenko wrote:
>>> On Mon, Jun 12, 2017 at 6:42 AM, Song liwei <liwei.song@...driver.com> wrote:
>>>> From: Liwei Song <liwei.song@...driver.com>
> 
>>>> After finished I2C block read/write, when unmap the data buffer,
>>>> a wrong device address was pass to dma_unmap_single(),
> 
>>>> the right
>>>> device address should be "dev" not "&adap->dev", the relation is
>>>> *(&adap->dev) == dev.
>>>
>>> This is confusing. You are telling that there are two copies of struct
>>> device here?
>>
>> Yes, there are two copies.
> 
> No, there is not. See below.

What I meant was that there are the struct device in pci_dev->dev and the
struct device in adap->dev. That seems like two copies of struct device
to me. I didn't mean that they are copies in the sense that they have the
same content, but in the sense that they are both struct device.

I guess we can argue ourselves blue over this point.

> There are two struct devices, 

Hmm, two struct devices, I seem to recall that from somewhere... :-)

>                               one is a real PCI device, which
> represents actual device what *does* DMA.
> This struct should be used according to DMA API.

When you put it like that, it's obvious that the patch is correct. I had
this feeling that little thought had gone into the choice to pick "dev"
over "&adap->dev", that's all.

> Another struct device which is wrongly used is an artificial one that
> represents I2C adapter in terms of Linux kernel.

Cheers,
peda

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ