1. 08 2月, 2014 1 次提交
    • D
      w1: fixup search to support abort from netlink · 42105698
      David Fries 提交于
      Before 63706172 "rework kthread_stop()" kthread_should_stop()
      always returned false when called from a non-kthread task, after it
      would oops as a non-kthread didn't have that structure and netlink was
      calling search from a thread which wasn't a kthread.  9d1817ca
      "w1: fix oops when w1_search is called from netlink connector",
      modified the code to avoid calling kthread_stop from a netlink thread.
      
      Introduce a w1_master flag and bit W1_ABORT_SEARCH to identify abort
      to cleanly support both kthread and netlink search abort.  A search
      can take seconds to run, so it is important to abort early if the
      hardware is removed in the middle of a search.
      Signed-off-by: NDavid Fries <David@Fries.net>
      Acked-by: NEvgeniy Polyakov <zbr@ioremap.net>
      Cc: Marcin Jurkowski <marcin1j@gmail.com>
      Cc: Josh Boyer <jwboyer@gmail.com>
      Cc: Sven Geggus <lists@fuchsschwanzdomain.de>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      42105698
  2. 13 11月, 2013 1 次提交
    • M
      drivers: w1: make w1_slave::flags long to avoid memory corruption · bb670937
      Michal Nazarewicz 提交于
      On architectures where long is more then 32 bits, modifying a 32-bit field
      with set_bit (and other atomic bit operations) may cause bytes following
      the field to by modified.
      
      Because the endianness of the bits within a field is the native endianness
      of the CPU[1], on big-endian machines, bit number zero is in the last byte
      of the field.
      
      Therefore, `set_bit(0, ptr)' on a 64-bit big-endian machine is roughly
      equivalent to `((char *)ptr)[7] |= 1', and since w1 driver uses a 32-bit
      field for holding the flags, this causes bytes beyond the field to be
      modified.
      
      [1] From Documentation/atomic_ops.txt:
      
          Native atomic bit operations are defined to operate on objects
          aligned to the size of an "unsigned long" C data type, and are
          least of that size.  The endianness of the bits within each
          "unsigned long" are the native endianness of the cpu.
      Signed-off-by: NMichal Nazarewicz <mina86@mina86.com>
      Cc: Evgeniy Polyakov <zbr@ioremap.net>
      Cc: Greg KH <greg@kroah.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      bb670937
  3. 07 10月, 2013 2 次提交
  4. 12 9月, 2013 1 次提交
  5. 23 8月, 2013 3 次提交
  6. 04 6月, 2013 1 次提交
  7. 13 3月, 2013 1 次提交
    • M
      w1: fix oops when w1_search is called from netlink connector · 9d1817ca
      Marcin Jurkowski 提交于
      On Sat, Mar 02, 2013 at 10:45:10AM +0100, Sven Geggus wrote:
      > This is the bad commit I found doing git bisect:
      > 04f482fa is the first bad commit
      > commit 04f482fa
      > Author: Patrick McHardy <kaber@trash.net>
      > Date:   Mon Mar 28 08:39:36 2011 +0000
      
      Good job. I was too lazy to bisect for bad commit;)
      
      Reading the code I found problematic kthread_should_stop call from netlink
      connector which causes the oops. After applying a patch, I've been testing
      owfs+w1 setup for nearly two days and it seems to work very reliable (no
      hangs, no memleaks etc).
      More detailed description and possible fix is given below:
      
      Function w1_search can be called from either kthread or netlink callback.
      While the former works fine, the latter causes oops due to kthread_should_stop
      invocation.
      
      This patch adds a check if w1_search is serving netlink command, skipping
      kthread_should_stop invocation if so.
      Signed-off-by: NMarcin Jurkowski <marcin1j@gmail.com>
      Acked-by: NEvgeniy Polyakov <zbr@ioremap.net>
      Cc: Josh Boyer <jwboyer@gmail.com>
      Tested-by: NSven Geggus <lists@fuchsschwanzdomain.de>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: stable <stable@vger.kernel.org> # 3.0+
      9d1817ca
  8. 22 11月, 2012 1 次提交
  9. 14 6月, 2012 2 次提交
    • N
      W1: split master mutex to avoid deadlocks. · b02f8bed
      NeilBrown 提交于
      The 'mutex' in struct w1_master is use for two very different
      purposes.
      
      Firstly it protects various data structures such as the list of all
      slaves.
      
      Secondly it protects the w1 buss against concurrent accesses.
      
      This can lead to deadlocks when the ->probe code called while adding a
      slave needs to talk on the bus, as is the case for power_supply
      devices.
      ds2780 and ds2781 drivers contain a work around to track which
      process hold the lock simply to avoid this deadlock.  bq27000 doesn't
      have that work around and so deadlocks.
      
      There are other possible deadlocks involving sysfs.
      When removing a device the sysfs s_active lock is held, so the lock
      that protects the slave list must take precedence over s_active.
      However when access power_supply attributes via sysfs, the s_active
      lock must take precedence over the lock that protects accesses to
      the bus.
      
      So to avoid deadlocks between w1 slaves and sysfs, these must be
      two separate locks.  Making them separate means that the work around
      in ds2780 and ds2781 can be removed.
      
      So this patch:
       - adds a new mutex: "bus_mutex" which serialises access to the bus.
       - takes in mutex in w1_search and ds1wm_search while they access
         the bus for searching.  The mutex is dropped before calling the
         callback which adds the slave.
       - changes all slaves to use bus_mutex instead of mutex to
         protect access to the bus
       - removes w1_ds2790_io_nolock and w1_ds2781_io_nolock, and the
         related code from drivers/power/ds278[01]_battery.c which
         calls them.
      Signed-off-by: NNeilBrown <neilb@suse.de>
      Acked-by: NEvgeniy Polyakov <zbr@ioremap.net>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      b02f8bed
    • G
      Revert "w1: introduce a slave mutex for serializing IO" · dd0aa67c
      Greg Kroah-Hartman 提交于
      This reverts commit 59d4467b.
      
      Turns out it was the wrong version, will apply the correct version after
      this.
      Reported-by: NNeilBrown <neilb@suse.de>
      Cc: Evgeniy Polyakov <zbr@ioremap.net>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      dd0aa67c
  10. 13 6月, 2012 2 次提交
  11. 10 4月, 2012 1 次提交
  12. 03 4月, 2012 1 次提交
  13. 10 12月, 2011 1 次提交
  14. 26 8月, 2011 1 次提交
  15. 27 7月, 2011 1 次提交
  16. 27 5月, 2011 1 次提交
  17. 28 10月, 2010 1 次提交
  18. 22 5月, 2010 1 次提交
  19. 05 2月, 2010 1 次提交
  20. 07 1月, 2009 1 次提交
  21. 17 10月, 2008 9 次提交
  22. 07 2月, 2008 1 次提交
  23. 15 1月, 2008 1 次提交
  24. 13 10月, 2007 1 次提交
    • K
      Driver core: change add_uevent_var to use a struct · 7eff2e7a
      Kay Sievers 提交于
      This changes the uevent buffer functions to use a struct instead of a
      long list of parameters. It does no longer require the caller to do the
      proper buffer termination and size accounting, which is currently wrong
      in some places. It fixes a known bug where parts of the uevent
      environment are overwritten because of wrong index calculations.
      
      Many thanks to Mathieu Desnoyers for finding bugs and improving the
      error handling.
      Signed-off-by: NKay Sievers <kay.sievers@vrfy.org>
      Cc: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
      Cc: Cornelia Huck <cornelia.huck@de.ibm.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      
      7eff2e7a
  25. 25 9月, 2007 1 次提交
  26. 20 7月, 2007 1 次提交
  27. 18 7月, 2007 1 次提交
    • R
      Freezer: make kernel threads nonfreezable by default · 83144186
      Rafael J. Wysocki 提交于
      Currently, the freezer treats all tasks as freezable, except for the kernel
      threads that explicitly set the PF_NOFREEZE flag for themselves.  This
      approach is problematic, since it requires every kernel thread to either
      set PF_NOFREEZE explicitly, or call try_to_freeze(), even if it doesn't
      care for the freezing of tasks at all.
      
      It seems better to only require the kernel threads that want to or need to
      be frozen to use some freezer-related code and to remove any
      freezer-related code from the other (nonfreezable) kernel threads, which is
      done in this patch.
      
      The patch causes all kernel threads to be nonfreezable by default (ie.  to
      have PF_NOFREEZE set by default) and introduces the set_freezable()
      function that should be called by the freezable kernel threads in order to
      unset PF_NOFREEZE.  It also makes all of the currently freezable kernel
      threads call set_freezable(), so it shouldn't cause any (intentional)
      change of behaviour to appear.  Additionally, it updates documentation to
      describe the freezing of tasks more accurately.
      
      [akpm@linux-foundation.org: build fixes]
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      Acked-by: NNigel Cunningham <nigel@nigel.suspend2.net>
      Cc: Pavel Machek <pavel@ucw.cz>
      Cc: Oleg Nesterov <oleg@tv-sign.ru>
      Cc: Gautham R Shenoy <ego@in.ibm.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      83144186