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-next>] [day] [month] [year] [list]
Message-Id: <1474041765-17818-1-git-send-email-bgolaszewski@baylibre.com>
Date:   Fri, 16 Sep 2016 18:02:41 +0200
From:   Bartosz Golaszewski <bgolaszewski@...libre.com>
To:     Linus Walleij <linus.walleij@...aro.org>,
        Alexandre Courbot <gnurou@...il.com>,
        Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
        Vignesh R <vigneshr@...com>, Yong Li <yong.b.li@...el.com>,
        Geert Uytterhoeven <geert+renesas@...der.be>,
        Peter Zijlstra <peterz@...radead.org>,
        Ingo Molnar <mingo@...hat.com>,
        Wolfram Sang <wsa@...-dreams.de>, Peter Rosin <peda@...ntia.se>
Cc:     linux-i2c <linux-i2c@...r.kernel.org>,
        linux-gpio <linux-gpio@...r.kernel.org>,
        LKML <linux-kernel@...r.kernel.org>,
        Bartosz Golaszewski <bgolaszewski@...libre.com>
Subject: [PATCH v2 0/4] gpio: fix an incorrect lockdep warning

If an I2C GPIO multiplexer is driven by a GPIO provided by an expander
when there's a second expander using the same device driver on one of
the I2C bus segments, lockdep prints a deadlock warning when trying to
set the direction or the value of the GPIOs provided by the second
expander.

This series exports an already existing function from i2c-core as
public API and reuses it in pca953x to pass a correct lock subclass
to lockdep.

Note: if this series gets merged, I'll prepare follow-up patches for
other expanders for which a similar problem could potentially occur.

Tested with the following setup:

 -------             ---------  Bus segment 1 |         |
|       |           |         |---------------  Devices
|       | SCL/SDA   |         |               |         |
| Linux |-----------| I2C MUX |                - - - - -
|       |    |      |         | Bus segment 2
|       |    |      |         |-------------------
 -------     |       ---------                    |
             |           |                    - - - - -
        ------------     | MUX GPIO          |         |
       |            |    |                     Devices
       |    GPIO    |    |                   |         |
       | Expander 1 |----                     - - - - -
       |            |                             |
        ------------                              | SCL/SDA
                                                  |
                                             ------------
                                            |            |
                                            |    GPIO    |
                                            | Expander 2 |
                                            |            |
                                             ------------

where expander 1 is a pca9534 and expander 2 is a pca9535.

v1 -> v2:
- added patches 1/4, 2/4 & 3/4
- used i2c_adapter_depth() in patch 4/4 in order to detect multiple
  adapter nesting

Bartosz Golaszewski (4):
  i2c: export i2c_adapter_depth()
  lockdep: make MAX_LOCKDEP_SUBCLASSES unconditionally visible
  i2c: add a warning to i2c_adapter_depth()
  gpio: pca953x: fix an incorrect lockdep warning

 drivers/gpio/gpio-pca953x.c |  2 ++
 drivers/i2c/i2c-core.c      | 12 +++++-------
 include/linux/i2c.h         |  1 +
 include/linux/lockdep.h     |  4 ++--
 4 files changed, 10 insertions(+), 9 deletions(-)

-- 
2.7.4

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ