1. 17 10月, 2013 5 次提交
  2. 06 10月, 2013 2 次提交
  3. 29 9月, 2013 2 次提交
  4. 28 9月, 2013 10 次提交
    • G
      driver-core: remove struct bus_type.bus_attrs · b4e46138
      Greg Kroah-Hartman 提交于
      Now that all in-kernel users of bus_type.bus_attrs have been converted
      to use bus_groups instead, the bus_attrs field, and logic surrounding
      it, can be removed.
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      b4e46138
    • J
      i2c: ismt: initialize DMA buffer · bf416910
      James Ralston 提交于
      This patch adds code to initialize the DMA buffer to compensate for
      possible hardware data corruption.
      Signed-off-by: NJames Ralston <james.d.ralston@intel.com>
      [wsa: changed to use 'sizeof']
      Signed-off-by: NWolfram Sang <wsa@the-dreams.de>
      bf416910
    • R
      drm/msm: use drm_gem_dumb_destroy helper · 30600a90
      Rob Clark 提交于
      Signed-off-by: NRob Clark <robdclark@gmail.com>
      30600a90
    • R
      drm/msm: deal with mach/iommu.h removal · 33b55963
      Rob Clark 提交于
      We still need an API exported by msm iommu driver (but not visible in
      any public header anymore).  For now, just declare the prototype
      ourselves, but when msm iommu driver provides a better option, use that
      instead.
      Signed-off-by: NRob Clark <robdclark@gmail.com>
      33b55963
    • J
      drm/msm: Remove iommu include from mdp4_kms.c · c55d1c41
      Joerg Roedel 提交于
      The include file has been removed and the file does not
      need it anyway, so remove it. Fixes a compile error.
      Signed-off-by: NJoerg Roedel <joro@8bytes.org>
      Signed-off-by: NRob Clark <robdclark@gmail.com>
      c55d1c41
    • T
      drm/msm: Odd PTR_ERR usage · e4826a94
      Thomas Meyer 提交于
      The variable priv->kms is not initialized yet.
      
      Found by "scripts/coccinelle/tests/odd_ptr_err.cocci".
      PTR_ERR should access the value just tested by IS_ERR.
      Signed-off-by: NThomas Meyer <thomas@m3y3r.de>
      e4826a94
    • C
      i2c: designware: 10-bit addressing mode enabling if I2C_DYNAMIC_TAR_UPDATE is set · bd63ace4
      Chew, Chiau Ee 提交于
      According to Designware I2C spec, if I2C_DYNAMIC_TAR_UPDATE is set to 1,
      the 10-bit addressing mode is controlled by IC_10BITADDR_MASTER bit of
      IC_TAR register instead of IC_CON register. The IC_10BITADDR_MASTER
      in IC_CON register becomes read-only copy. Since I2C_DYNAMIC_TAR_UPDATE
      value can't be detected from hardware register, so we will always set the
      IC_10BITADDR_MASTER bit in both IC_CON and IC_TAR register whenever 10-bit
      addresing mode is requested by user application.
      Signed-off-by: NChew, Chiau Ee <chiau.ee.chew@intel.com>
      Reviewed-by: NMika Westerberg <mika.westerberg@linux.intel.com>
      Signed-off-by: NWolfram Sang <wsa@the-dreams.de>
      bd63ace4
    • T
      i2c: mv64xxx: Do not use writel_relaxed() · 85b3a935
      Thierry Reding 提交于
      The driver is used on PowerPC which don't provide writel_relaxed(). This
      breaks the c2k and prpmc2800 default configurations. To fix the build,
      turn the calls to writel_relaxed() into writel(). The impacts for ARM
      should be minimal.
      Signed-off-by: NThierry Reding <treding@nvidia.com>
      Signed-off-by: NWolfram Sang <wsa@the-dreams.de>
      85b3a935
    • T
      i2c: mv64xxx: Fix some build warnings · c1a99467
      Thierry Reding 提交于
      Some functions and variables are only used if the configuration selects
      HAVE_CLK. Protect them with a corresponding #ifdef CONFIG_HAVE_CLK block
      to avoid compiler warnings.
      Signed-off-by: NThierry Reding <treding@nvidia.com>
      [wsa: added marker to #endif]
      Signed-off-by: NWolfram Sang <wsa@the-dreams.de>
      c1a99467
    • K
      i2c: s3c2410: fix clk_disable/clk_unprepare WARNings · 15336913
      Kim Phillips 提交于
      commit d16933b3 "i2c: s3c2410: Move
      location of clk_prepare_enable() call in probe function" refactored
      clk_enable and clk_disable calls yet neglected to remove the
      clk_disable_unprepare call in the module's remove().
      
      It helps remove warnings on an arndale during unbind:
      
      echo 12c90000.i2c > /sys/bus/platform/devices/12c90000.i2c/driver/unbind
      
      ------------[ cut here ]------------
      WARNING: CPU: 0 PID: 2548 at drivers/clk/clk.c:842 clk_disable+0x18/0x24()
      Modules linked in:
      CPU: 0 PID: 2548 Comm: bash Not tainted 3.11.0-next-20130916-00003-gf4bddbc #6
      [<c0014d48>] (unwind_backtrace+0x0/0xf8) from [<c00117d0>] (show_stack+0x10/0x14)
      [<c00117d0>] (show_stack+0x10/0x14) from [<c0361be8>] (dump_stack+0x6c/0xac)
      [<c0361be8>] (dump_stack+0x6c/0xac) from [<c001d864>] (warn_slowpath_common+0x64/0x88)
      [<c001d864>] (warn_slowpath_common+0x64/0x88) from [<c001d8a4>] (warn_slowpath_null+0x1c/0x24)
      [<c001d8a4>] (warn_slowpath_null+0x1c/0x24) from [<c02c4a64>] (clk_disable+0x18/0x24)
      [<c02c4a64>] (clk_disable+0x18/0x24) from [<c028d0b0>] (s3c24xx_i2c_remove+0x28/0x70)
      [<c028d0b0>] (s3c24xx_i2c_remove+0x28/0x70) from [<c0217a10>] (platform_drv_remove+0x18/0x1c)
      [<c0217a10>] (platform_drv_remove+0x18/0x1c) from [<c0216358>] (__device_release_driver+0x58/0xb4)
      [<c0216358>] (__device_release_driver+0x58/0xb4) from [<c02163d0>] (device_release_driver+0x1c/0x28)
      [<c02163d0>] (device_release_driver+0x1c/0x28) from [<c02153c0>] (unbind_store+0x58/0x90)
      [<c02153c0>] (unbind_store+0x58/0x90) from [<c0214c90>] (drv_attr_store+0x20/0x2c)
      [<c0214c90>] (drv_attr_store+0x20/0x2c) from [<c01032c0>] (sysfs_write_file+0x168/0x198)
      [<c01032c0>] (sysfs_write_file+0x168/0x198) from [<c00ae1c0>] (vfs_write+0xb0/0x194)
      [<c00ae1c0>] (vfs_write+0xb0/0x194) from [<c00ae594>] (SyS_write+0x3c/0x70)
      [<c00ae594>] (SyS_write+0x3c/0x70) from [<c000e3e0>] (ret_fast_syscall+0x0/0x30)
      ---[ end trace 4c9f9403066f57a6 ]---
      ------------[ cut here ]------------
      WARNING: CPU: 0 PID: 2548 at drivers/clk/clk.c:751 clk_unprepare+0x14/0x1c()
      Modules linked in:
      CPU: 0 PID: 2548 Comm: bash Tainted: G        W    3.11.0-next-20130916-00003-gf4bddbc #6
      [<c0014d48>] (unwind_backtrace+0x0/0xf8) from [<c00117d0>] (show_stack+0x10/0x14)
      [<c00117d0>] (show_stack+0x10/0x14) from [<c0361be8>] (dump_stack+0x6c/0xac)
      [<c0361be8>] (dump_stack+0x6c/0xac) from [<c001d864>] (warn_slowpath_common+0x64/0x88)
      [<c001d864>] (warn_slowpath_common+0x64/0x88) from [<c001d8a4>] (warn_slowpath_null+0x1c/0x24)
      [<c001d8a4>] (warn_slowpath_null+0x1c/0x24) from [<c02c5834>] (clk_unprepare+0x14/0x1c)
      [<c02c5834>] (clk_unprepare+0x14/0x1c) from [<c028d0b8>] (s3c24xx_i2c_remove+0x30/0x70)
      [<c028d0b8>] (s3c24xx_i2c_remove+0x30/0x70) from [<c0217a10>] (platform_drv_remove+0x18/0x1c)
      [<c0217a10>] (platform_drv_remove+0x18/0x1c) from [<c0216358>] (__device_release_driver+0x58/0xb4)
      [<c0216358>] (__device_release_driver+0x58/0xb4) from [<c02163d0>] (device_release_driver+0x1c/0x28)
      [<c02163d0>] (device_release_driver+0x1c/0x28) from [<c02153c0>] (unbind_store+0x58/0x90)
      [<c02153c0>] (unbind_store+0x58/0x90) from [<c0214c90>] (drv_attr_store+0x20/0x2c)
      [<c0214c90>] (drv_attr_store+0x20/0x2c) from [<c01032c0>] (sysfs_write_file+0x168/0x198)
      [<c01032c0>] (sysfs_write_file+0x168/0x198) from [<c00ae1c0>] (vfs_write+0xb0/0x194)
      [<c00ae1c0>] (vfs_write+0xb0/0x194) from [<c00ae594>] (SyS_write+0x3c/0x70)
      [<c00ae594>] (SyS_write+0x3c/0x70) from [<c000e3e0>] (ret_fast_syscall+0x0/0x30)
      ---[ end trace 4c9f9403066f57a7 ]---
      Signed-off-by: NKim Phillips <kim.phillips@linaro.org>
      Signed-off-by: NWolfram Sang <wsa@the-dreams.de>
      15336913
  5. 27 9月, 2013 21 次提交
    • L
      staging: r8188eu: Add new device ID · df3f4edc
      Larry Finger 提交于
      The DLink DWA-125 Rev D1 also uses this driver.
      Signed-off-by: NLarry Finger <Larry.Finger@lwfinger.net>
      Reported-by: NSergey Kostanbaev <sergey.kostanbaev@gmail.com>
      Tested-by: NSergey Kostanbaev <sergey.kostanbaev@gmail.com>
      Cc: Sergey Kostanbaev <sergey.kostanbaev@gmail.com>
      Cc: stable <stable@vger.kernel.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      df3f4edc
    • D
      usb: dwc3: add support for Merrifield · 85601f8c
      David Cohen 提交于
      Add PCI id for Intel Merrifield
      Signed-off-by: NDavid Cohen <david.a.cohen@linux.intel.com>
      Cc: stable <stable@vger.kernel.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      85601f8c
    • S
      USB: fsl/ehci: fix failure of checking PHY_CLK_VALID during reinitialization · eee41b49
      Shengzhou Liu 提交于
      In case of usb phy reinitialization:
      e.g. insmod usb-module(usb works well) -> rmmod usb-module -> insmod usb-module
      It found the PHY_CLK_VALID bit didn't work if it's not with the power-on reset.
      So we just check PHY_CLK_VALID bit during the stage with POR, this can be met
      by the tricky of checking FSL_SOC_USB_PRICTRL register.
      Signed-off-by: NShengzhou Liu <Shengzhou.Liu@freescale.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      eee41b49
    • A
      USB: Fix breakage in ffs_fs_mount() · 2606b28a
      Al Viro 提交于
      	There's a bunch of failure exits in ffs_fs_mount() with
      seriously broken recovery logics.  Most of that appears to stem
      from misunderstanding of the ->kill_sb() semantics; unlike
      ->put_super() it is called for *all* superblocks of given type,
      no matter how (in)complete the setup had been.  ->put_super()
      is called only if ->s_root is not NULL; any failure prior to
      setting ->s_root will have the call of ->put_super() skipped.
      ->kill_sb(), OTOH, awaits every superblock that has come from
      sget().
      
      Current behaviour of ffs_fs_mount():
      
      We have struct ffs_sb_fill_data data on stack there.  We do
      	ffs_dev = functionfs_acquire_dev_callback(dev_name);
      and store that in data.private_data.  Then we call mount_nodev(),
      passing it ffs_sb_fill() as a callback.  That will either fail
      outright, or manage to call ffs_sb_fill().  There we allocate an
      instance of struct ffs_data, slap the value of ffs_dev (picked
      from data.private_data) into ffs->private_data and overwrite
      data.private_data by storing ffs into an overlapping member
      (data.ffs_data).  Then we store ffs into sb->s_fs_info and attempt
      to set the rest of the things up (root inode, root dentry, then
      create /ep0 there).  Any of those might fail.  Should that
      happen, we get ffs_fs_kill_sb() called before mount_nodev()
      returns.  If mount_nodev() fails for any reason whatsoever,
      we proceed to
      	functionfs_release_dev_callback(data.ffs_data);
      
      That's broken in a lot of ways.  Suppose the thing has failed in
      allocation of e.g. root inode or dentry.  We have
      	functionfs_release_dev_callback(ffs);
      	ffs_data_put(ffs);
      done by ffs_fs_kill_sb() (ffs accessed via sb->s_fs_info), followed by
      	functionfs_release_dev_callback(ffs);
      from ffs_fs_mount() (via data.ffs_data).  Note that the second
      functionfs_release_dev_callback() has every chance to be done to freed memory.
      
      Suppose we fail *before* root inode allocation.  What happens then?
      ffs_fs_kill_sb() doesn't do anything to ffs (it's either not called at all,
      or it doesn't have a pointer to ffs stored in sb->s_fs_info).  And
      	functionfs_release_dev_callback(data.ffs_data);
      is called by ffs_fs_mount(), but here we are in nasal daemon country - we
      are reading from a member of union we'd never stored into.  In practice,
      we'll get what we used to store into the overlapping field, i.e. ffs_dev.
      And then we get screwed, since we treat it (struct gfs_ffs_obj * in
      disguise, returned by functionfs_acquire_dev_callback()) as struct
      ffs_data *, pick what would've been ffs_data ->private_data from it
      (*well* past the actual end of the struct gfs_ffs_obj - struct ffs_data
      is much bigger) and poke in whatever it points to.
      
      FWIW, there's a minor leak on top of all that in case if ffs_sb_fill()
      fails on kstrdup() - ffs is obviously forgotten.
      
      The thing is, there is no point in playing all those games with union.
      Just allocate and initialize ffs_data *before* calling mount_nodev() and
      pass a pointer to it via data.ffs_data.  And once it's stored in
      sb->s_fs_info, clear data.ffs_data, so that ffs_fs_mount() knows that
      it doesn't need to kill the sucker manually - from that point on
      we'll have it done by ->kill_sb().
      Signed-off-by: NAl Viro <viro@zeniv.linux.org.uk>
      Acked-by: NMichal Nazarewicz <mina86@mina86.com>
      Cc: stable <stable@vger.kernel.org> # 3.3+
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      2606b28a
    • J
      backlight: atmel-pwm-bl: fix deferred probe from __init · 9d3fde86
      Johan Hovold 提交于
      Move probe out of __init section and don't use platform_driver_probe
      which cannot be used with deferred probing.
      
      Since commit e9354576 ("gpiolib: Defer failed gpio requests by default")
      this driver might return -EPROBE_DEFER if a gpio_request fails.
      
      Cc: Richard Purdie <rpurdie@rpsys.net>
      Cc: Jingoo Han <jg1.han@samsung.com>
      Cc: Jean-Christophe Plagniol-Villard <plagnioj@jcrosoft.com>
      Signed-off-by: NJohan Hovold <jhovold@gmail.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      9d3fde86
    • J
      usb: phy: gpio-vbus: fix deferred probe from __init · 17dab4d5
      Johan Hovold 提交于
      Move probe out of __init section and don't use platform_driver_probe
      which cannot be used with deferred probing.
      
      Since commit e9354576 ("gpiolib: Defer failed gpio requests by default")
      and 04bf3011 ("regulator: Support driver probe deferral") this driver
      might return -EPROBE_DEFER if a gpio_request or regulator_get fails.
      
      Cc: Felipe Balbi <balbi@ti.com>
      Signed-off-by: NJohan Hovold <jhovold@gmail.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      17dab4d5
    • J
      usb: gadget: pxa25x_udc: fix deferred probe from __init · f3a9995f
      Johan Hovold 提交于
      Move probe out of __init section and don't use platform_driver_probe
      which cannot be used with deferred probing.
      
      Since commit e9354576 ("gpiolib: Defer failed gpio requests by default")
      this driver might return -EPROBE_DEFER if a gpio_request fails.
      
      Cc: Eric Miao <eric.y.miao@gmail.com>
      Cc: Russell King <linux@arm.linux.org.uk>
      Cc: Haojian Zhuang <haojian.zhuang@gmail.com>
      Cc: Felipe Balbi <balbi@ti.com>
      Signed-off-by: NJohan Hovold <jhovold@gmail.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      f3a9995f
    • J
      pcmcia: at91_cf: fix deferred probe from __init · 16a7c7cf
      Johan Hovold 提交于
      Move probe out of __init section and don't use platform_driver_probe
      which cannot be used with deferred probing.
      
      Since commit e9354576 ("gpiolib: Defer failed gpio requests by default")
      this driver might return -EPROBE_DEFER if a gpio_request fails.
      
      Cc: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
      Signed-off-by: NJohan Hovold <jhovold@gmail.com>
      Acked-by: NNicolas Ferre <nicolas.ferre@atmel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      16a7c7cf
    • J
      mtd: atmel_nand: fix deferred probe from __init · 2c2b9285
      Johan Hovold 提交于
      Move probe out of __init section and don't use platform_driver_probe
      which cannot be used with deferred probing.
      
      Since commit e9354576 ("gpiolib: Defer failed gpio requests by default")
      this driver might return -EPROBE_DEFER if a gpio_request fails.
      
      Cc: David Woodhouse <dwmw2@infradead.org>
      Cc: Josh Wu <josh.wu@atmel.com>
      Signed-off-by: NJohan Hovold <jhovold@gmail.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      2c2b9285
    • J
      mmc: mvsdio: fix deferred probe from __init · 1867adee
      Johan Hovold 提交于
      Move probe out of __init section and don't use platform_driver_probe
      which cannot be used with deferred probing.
      
      Since commit e9354576 ("gpiolib: Defer failed gpio requests by default")
      this driver might return -EPROBE_DEFER if the mmc_gpio_request_cd fails.
      
      Cc: Nicolas Pitre <nico@fluxnic.net>
      Cc: Chris Ball <cjb@laptop.org>
      Signed-off-by: NJohan Hovold <jhovold@gmail.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      1867adee
    • J
      driver core: prevent deferred probe with platform_driver_probe · 3f9120b0
      Johan Hovold 提交于
      Prevent drivers relying on platform_driver_probe from requesting
      deferred probing in order to avoid further futile probe attempts (either
      the driver has been unregistered or its probe function has been set to
      platform_drv_probe_fail when probing is retried).
      
      Note that several platform drivers currently return subsystem errors
      from probe and that these can include -EPROBE_DEFER (e.g. if a gpio
      request fails).
      
      Add a warning to platform_drv_probe that can be used to catch drivers
      that inadvertently request probe deferral while using
      platform_driver_probe.
      Signed-off-by: NJohan Hovold <jhovold@gmail.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      3f9120b0
    • G
      scsi: fcoe: fix build error · 1296fc02
      Greg Kroah-Hartman 提交于
      I had a typo in a variable name for the previous patch (SCSI: fcoe:
      convert bus code to use bus_group) that broke the build, this fixes
      that.
      Reported-by: Nkbuild test robot <fengguang.wu@intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      1296fc02
    • G
      PCI: convert bus code to use drv_groups · 19b6e6a4
      Greg Kroah-Hartman 提交于
      The drv_attrs field of struct bus_type is going away soon, drv_groups
      should be used instead.  This converts the PCI bus code to use the
      correct field.
      
      Cc: Bjorn Helgaas <bhelgaas@google.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      19b6e6a4
    • G
      PCI: convert bus code to use bus_groups · 244afeca
      Greg Kroah-Hartman 提交于
      The bus_attrs field of struct bus_type is going away soon, dev_groups
      should be used instead.  This converts the PCI bus code to use the
      correct field.
      
      Cc: Bjorn Helgaas <bhelgaas@google.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      244afeca
    • G
      SCSI: fcoe: convert bus code to use bus_groups · c88dc555
      Greg Kroah-Hartman 提交于
      The bus_attrs field of struct bus_type is going away soon, dev_groups
      should be used instead.  This converts the fcoe bus code to use the
      correct field.
      
      Cc: Robert Love <robert.w.love@intel.com>
      Cc: "James E.J. Bottomley" <JBottomley@parallels.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      c88dc555
    • G
      rapidio: convert bus code to use bus_groups · ed1d2da2
      Greg Kroah-Hartman 提交于
      The bus_attrs field of struct bus_type is going away soon, dev_groups
      should be used instead.  This converts the rapidio bus code to use the
      correct field.
      
      Cc: Matt Porter <mporter@kernel.crashing.org>
      Cc: Alexandre Bounine <alexandre.bounine@idt.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      ed1d2da2
    • N
      firmware: Be a bit more verbose about direct firmware loading failure · 3e358ac2
      Neil Horman 提交于
      The direct firmware loading interface is a bit quiet about failures.  Failures
      that occur during loading are masked if firmware exists in multiple locations,
      and may be masked entirely in the event that we fall back to the user mode
      helper code.  It would be nice to see some of the more unexpected errors get
      logged, so in the event that you expect the direct firmware loader to work (like
      if CONFIG_FW_LOADER_USER_HELPER is enabled), and something goes wrong, you can
      figure out what happened.
      Signed-off-by: NNeil Horman <nhorman@tuxdriver.com>
      Acked-by: NMing Lei <ming.lei@canonical.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      3e358ac2
    • T
      sysfs: clean up sysfs_get_dirent() · 388975cc
      Tejun Heo 提交于
      The pre-existing sysfs interfaces which take explicit namespace
      argument are weird in that they place the optional @ns in front of
      @name which is contrary to the established convention.  For example,
      we end up forcing vast majority of sysfs_get_dirent() users to do
      sysfs_get_dirent(parent, NULL, name), which is silly and error-prone
      especially as @ns and @name may be interchanged without causing
      compilation warning.
      
      This renames sysfs_get_dirent() to sysfs_get_dirent_ns() and swap the
      positions of @name and @ns, and sysfs_get_dirent() is now a wrapper
      around sysfs_get_dirent_ns().  This makes confusions a lot less
      likely.
      
      There are other interfaces which take @ns before @name.  They'll be
      updated by following patches.
      
      This patch doesn't introduce any functional changes.
      
      v2: EXPORT_SYMBOL_GPL() wasn't updated leading to undefined symbol
          error on module builds.  Reported by build test robot.  Fixed.
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Cc: Eric W. Biederman <ebiederm@xmission.com>
      Cc: Kay Sievers <kay@vrfy.org>
      Cc: Fengguang Wu <fengguang.wu@intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      388975cc
    • T
      sysfs: remove ktype->namespace() invocations in symlink code · 4b30ee58
      Tejun Heo 提交于
      There's no reason for sysfs to be calling ktype->namespace().  It is
      backwards, obfuscates what's going on and unnecessarily tangles two
      separate layers.
      
      There are two places where symlink code calls ktype->namespace().
      
      * sysfs_do_create_link_sd() calls it to find out the namespace tag of
        the target directory.  Unless symlinking races with cross-namespace
        renaming, this equals @target_sd->s_ns.
      
      * sysfs_rename_link() uses it to find out the new namespace to rename
        to and the new namespace can be different from the existing one.
        The function is renamed to sysfs_rename_link_ns() with an explicit
        @ns argument and the ktype->namespace() invocation is shifted to the
        device layer.
      
      While this patch replaces ktype->namespace() invocation with the
      recorded result in @target_sd, this shouldn't result in any behvior
      difference.
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Cc: Eric W. Biederman <ebiederm@xmission.com>
      Cc: Kay Sievers <kay@vrfy.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      4b30ee58
    • T
      sysfs: make attr namespace interface less convoluted · 58292cbe
      Tejun Heo 提交于
      sysfs ns (namespace) implementation became more convoluted than
      necessary while trying to hide ns information from visible interface.
      The relatively recent attr ns support is a good example.
      
      * attr ns tag is determined by sysfs_ops->namespace() callback while
        dir tag is determined by kobj_type->namespace().  The placement is
        arbitrary.
      
      * Instead of performing operations with explicit ns tag, the namespace
        callback is routed through sysfs_attr_ns(), sysfs_ops->namespace(),
        class_attr_namespace(), class_attr->namespace().  It's not simpler
        in any sense.  The only thing this convolution does is traversing
        the whole stack backwards.
      
      The namespace callbacks are unncessary because the operations involved
      are inherently synchronous.  The information can be provided in in
      straight-forward top-down direction and reversing that direction is
      unnecessary and against basic design principles.
      
      This backward interface is unnecessarily convoluted and hinders
      properly separating out sysfs from driver model / kobject for proper
      layering.  This patch updates attr ns support such that
      
      * sysfs_ops->namespace() and class_attr->namespace() are dropped.
      
      * sysfs_{create|remove}_file_ns(), which take explicit @ns param, are
        added and sysfs_{create|remove}_file() are now simple wrappers
        around the ns aware functions.
      
      * ns handling is dropped from sysfs_chmod_file().  Nobody uses it at
        this point.  sysfs_chmod_file_ns() can be added later if necessary.
      
      * Explicit @ns is propagated through class_{create|remove}_file_ns()
        and netdev_class_{create|remove}_file_ns().
      
      * driver/net/bonding which is currently the only user of attr
        namespace is updated to use netdev_class_{create|remove}_file_ns()
        with @bh->net as the ns tag instead of using the namespace callback.
      
      This patch should be an equivalent conversion without any functional
      difference.  It makes the code easier to follow, reduces lines of code
      a bit and helps proper separation and layering.
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Cc: Eric W. Biederman <ebiederm@xmission.com>
      Cc: Kay Sievers <kay@vrfy.org>
      Acked-by: NDavid S. Miller <davem@davemloft.net>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      58292cbe
    • B
      driver core : Fix use after free of dev->parent in device_shutdown · f123db8e
      Benson Leung 提交于
      The put_device(dev) at the bottom of the loop of device_shutdown
      may result in the dev being cleaned up. In device_create_release,
      the dev is kfreed.
      
      However, device_shutdown attempts to use the dev pointer again after
      put_device by referring to dev->parent.
      
      Copy the parent pointer instead to avoid this condition.
      
      This bug was found on Chromium OS's chromeos-3.8, which is based on v3.8.11.
      See bug report : https://code.google.com/p/chromium/issues/detail?id=297842
      This can easily be reproduced when shutting down with
      hidraw devices that report battery condition.
      Two examples are the HP Bluetooth Mouse X4000b and the Apple Magic Mouse.
      For example, with the magic mouse :
      The dev in question is "hidraw0"
      dev->parent is "magicmouse"
      
      In the course of the shutdown for this device, the input event cleanup calls
      a put on hidraw0, decrementing its reference count.
      When we finally get to put_device(dev) in device_shutdown, kobject_cleanup
      is called and device_create_release does kfree(dev).
      dev->parent is no longer valid, and we may crash in
      put_device(dev->parent).
      
      This change should be applied on any kernel with this change :
      d1c6c030
      
      Cc: stable@vger.kernel.org
      Signed-off-by: NBenson Leung <bleung@chromium.org>
      Reviewed-by: NMing Lei <ming.lei@canonical.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      f123db8e