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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <60306316-3dee-3bb8-3f42-7a6258102a42@gorani.run>
Date:   Wed, 8 Jul 2020 23:30:36 +0900
From:   Sungbo Eo <mans0n@...ani.run>
To:     Andy Shevchenko <andy.shevchenko@...il.com>
Cc:     Bartosz Golaszewski <bgolaszewski@...libre.com>,
        Linus Walleij <linus.walleij@...aro.org>,
        Michael Walle <michael@...le.cc>,
        LKML <linux-kernel@...r.kernel.org>,
        linux-gpio <linux-gpio@...r.kernel.org>
Subject: Re: [PATCH v5 1/2] gpio: add GPO driver for PCA9570

Thanks, it made me think about it deeper...

On 20. 7. 8. 오전 12:07, Andy Shevchenko wrote:
> On Tue, Jul 7, 2020 at 5:03 PM Sungbo Eo <mans0n@...ani.run> wrote:
>> On 20. 7. 6. 오후 9:00, Andy Shevchenko wrote:
> 
> ...
> 
>> But I don't really understand what mutex does here. The driver does not
>> need consecutive commands, it only sends/receives only one byte at a
>> time. And AFAIK each i2c_smbus function is already protected by a mutex.
>> So what should be exactly inside the lock? Should we protect the output
>> buffer as well? I'm not an expert on this so please enlighten me.
> 
> There are questions, answering them will give you a solution:
> - Since we have two functions doing i2c communications, can they
> clash? If so, does the i2c framework guarantee the serialisation?

I think it does.

> - Since we have a shared resource (buf), can accessors clash? How do
> we guarantee serialization?
> 

But the output buffer should be tied to the i2c operations. So I guess 
it requires a mutex here.

pca9570_get() does not access gpio->out so it does not need to be locked.

On the other hand, the whole pca9570_set() function should be protected, 
from reading gpio->out to rewriting to gpio->out. So pca9570_write() 
error check should be inside the lock as well. Am I right?

Thanks.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ