aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/serial/mos7720.c
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2013-06-28 10:34:48 -0700
committerBen Hutchings <ben@decadent.org.uk>2013-10-26 21:05:59 +0100
commitbc69de30e8b7933db4f0bbbb7340d13dcec53238 (patch)
tree5de95bd3497d64e0e043b293263bf6cc4d5b9f0a /drivers/usb/serial/mos7720.c
parent5c22eba5c7a15d915352743238facb571375107d (diff)
downloadkernel_samsung_smdk4412-bc69de30e8b7933db4f0bbbb7340d13dcec53238.zip
kernel_samsung_smdk4412-bc69de30e8b7933db4f0bbbb7340d13dcec53238.tar.gz
kernel_samsung_smdk4412-bc69de30e8b7933db4f0bbbb7340d13dcec53238.tar.bz2
rculist: list_first_or_null_rcu() should use list_entry_rcu()
commit c34ac00caefbe49d40058ae7200bd58725cebb45 upstream. list_first_or_null() should test whether the list is empty and return pointer to the first entry if not in a RCU safe manner. It's broken in several ways. * It compares __kernel @__ptr with __rcu @__next triggering the following sparse warning. net/core/dev.c:4331:17: error: incompatible types in comparison expression (different address spaces) * It doesn't perform rcu_dereference*() and computes the entry address using container_of() directly from the __rcu pointer which is inconsitent with other rculist interface. As a result, all three in-kernel users - net/core/dev.c, macvlan, cgroup - are buggy. They dereference the pointer w/o going through read barrier. * While ->next dereference passes through list_next_rcu(), the compiler is still free to fetch ->next more than once and thus nullify the "__ptr != __next" condition check. Fix it by making list_first_or_null_rcu() dereference ->next directly using ACCESS_ONCE() and then use list_entry_rcu() on it like other rculist accessors. v2: Paul pointed out that the compiler may fetch the pointer more than once nullifying the condition check. ACCESS_ONCE() added on ->next dereference. v3: Restored () around macro param which was accidentally removed. Spotted by Paul. Signed-off-by: Tejun Heo <tj@kernel.org> Reported-by: Fengguang Wu <fengguang.wu@intel.com> Cc: Dipankar Sarma <dipankar@in.ibm.com> Cc: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> Cc: "David S. Miller" <davem@davemloft.net> Cc: Li Zefan <lizefan@huawei.com> Cc: Patrick McHardy <kaber@trash.net> Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com> Reviewed-by: Josh Triplett <josh@joshtriplett.org> Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Diffstat (limited to 'drivers/usb/serial/mos7720.c')
0 files changed, 0 insertions, 0 deletions