[RESEND PATCH v2 0/3] drm: fix invalid user counters of i2c bus device

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a resend of the changes, the bugs were identified and fixed
one year ago, however the fixes are still not found in the mainline:

  http://dri-devel.freedesktop.narkive.com/cWNFTOZC/patch-v2-0-3-drm-fix-i2c-adapter-device-driver-user-counter

of_find_i2c_adapter_by_node() call requires quite often missing
put_device(), and i2c_put_adapter() releases a device locked by
i2c_get_adapter() only.

Below is a common error reproduction scenario as a result of the
misusage described above, this is run on iMX6 platform 4.8.0-rc1
with HDMI and I2C bus drivers compiled as kernel modules for
clarity after changing arch/arm/configs/imx_v6_v7_defconfig:

  -CONFIG_I2C_IMX=y
  +CONFIG_I2C_IMX=m
  -CONFIG_DRM_IMX_HDMI=y
  +CONFIG_DRM_IMX_HDMI=m

  root@imx6q:~# lsmod
  Not tainted
  dw_hdmi_ahb_audio 4082 0 - Live 0xbf02c000
  dw_hdmi_imx 3498 0 - Live 0xbf00d000
  dw_hdmi 16398 2 dw_hdmi_ahb_audio,dw_hdmi_imx, Live 0xbf004000
  i2c_imx 16687 0 - Live 0xbf017000

  root@imx6q:~# rmmod dw_hdmi_imx
  root@imx6q:~# lsmod
  Not tainted
  dw_hdmi_ahb_audio 4082 0 - Live 0xbf02c000
  dw_hdmi 16398 1 dw_hdmi_ahb_audio, Live 0xbf004000
  i2c_imx 16687 -1 - Live 0xbf017000
                ^^

  root@imx6q:~# rmmod i2c_imx
  rmmod: ERROR: Module i2c_imx is in use

To fix existing users of these interfaces use of_get_i2c_adapter_by_node()
interface, which is similar to i2c_get_adapter() in sense that an I2C bus
device driver found and locked by a user can be correctly unlocked by
i2c_put_adapter() call.

Changes from v2 to v2 resend:
- none

Changes from v1 to v2:
- none, this series is a straightforward bugfix, v1 was a blend of
  I2C core changes, bugfixes and improvements

Vladimir Zapolskiy (3):
  drm: dw_hdmi: use of_get_i2c_adapter_by_node interface
  drm: tilcdc: use of_get_i2c_adapter_by_node interface
  drm: tegra: use of_get_i2c_adapter_by_node interface

 drivers/gpu/drm/bridge/dw-hdmi.c       | 14 +++++++++-----
 drivers/gpu/drm/tegra/output.c         | 25 ++++++++++++++-----------
 drivers/gpu/drm/tilcdc/tilcdc_tfp410.c |  6 ++----
 3 files changed, 25 insertions(+), 20 deletions(-)

-- 
2.8.1

_______________________________________________
dri-devel mailing list
dri-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/dri-devel




[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux