1. 30 Jan, 2015 3 commits
    • Jim Lin's avatar
      pinctrl: Fix two deadlocks · a01bbd75
      Jim Lin authored
      commit db93facf upstream.
      
      This patch is to fix two deadlock cases.
      Deadlock 1:
      CPU #1
       pinctrl_register-> pinctrl_get ->
       create_pinctrl
       (Holding lock pinctrl_maps_mutex)
       -> get_pinctrl_dev_from_devname
       (Trying to acquire lock pinctrldev_list_mutex)
      CPU #0
       pinctrl_unregister
       (Holding lock pinctrldev_list_mutex)
       -> pinctrl_put ->> pinctrl_free ->
       pinctrl_dt_free_maps -> pinctrl_unregister_map
       (Trying to acquire lock pinctrl_maps_mutex)
      
      Simply to say
      CPU#1 is holding lock A and trying to acquire lock B,
      CPU#0 is holding lock B and trying to acquire lock A.
      
      Deadlock 2:
      CPU #3
       pinctrl_register-> pinctrl_get ->
       create_pinctrl
       (Holding lock pinctrl_maps_mutex)
       -> get_pinctrl_dev_from_devname
       (Trying to acquire lock pinctrldev_list_mutex)
      CPU #2
       pinctrl_unregister
       (Holding lock pctldev->mutex)
       -> pinctrl_put ->> pinctrl_free ->
       pinctrl_dt_free_maps -> pinctrl_unregister_map
       (Trying to acquire lock pinctrl_maps_mutex)
      CPU #0
       tegra_gpio_request
       (Holding lock pinctrldev_list_mutex)
       -> pinctrl_get_device_gpio_range
       (Trying to acquire lock pctldev->mutex)
      
      Simply to say
      CPU#3 is holding lock A and trying to acquire lock D,
      CPU#2 is holding lock B and trying to acquire lock A,
      CPU#0 is holding lock D and trying to acquire lock B.
      Signed-off-by: default avatarJim Lin <jilin@nvidia.com>
      Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      a01bbd75
    • Johan Hovold's avatar
      gpio: sysfs: fix gpio device-attribute leak · a9808403
      Johan Hovold authored
      commit 0915e6fe upstream.
      
      The gpio device attributes were never destroyed when the gpio was
      unexported (or on export failures).
      
      Use device_create_with_groups() to create the default device attributes
      of the gpio class device. Note that this also fixes the
      attribute-creation race with userspace for these attributes.
      
      Remove contingent attributes in export error path and on unexport.
      
      Fixes: d8f388d8 ("gpio: sysfs interface")
      Cc: stable <stable@vger.kernel.org>	# v2.6.27+
      Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
      Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      a9808403
    • Johan Hovold's avatar
      gpio: sysfs: fix gpio-chip device-attribute leak · aa35a487
      Johan Hovold authored
      commit 121b6a79 upstream.
      
      The gpio-chip device attributes were never destroyed when the device was
      removed.
      
      Fix by using device_create_with_groups() to create the device attributes
      of the chip class device.
      
      Note that this also fixes the attribute-creation race with userspace.
      
      Fixes: d8f388d8 ("gpio: sysfs interface")
      Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
      Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      
      
      aa35a487
  2. 27 Jan, 2015 37 commits