summaryrefslogtreecommitdiff
path: root/net/ipv4/tcp_input.c
diff options
context:
space:
mode:
authorRam Chandrasekar <rkumbako@codeaurora.org>2015-10-15 15:36:35 -0600
committerRam Chandrasekar <rkumbako@codeaurora.org>2016-12-02 15:42:46 -0700
commitc975089fd596688e1271339c7914892f20cc58bb (patch)
tree635155a53ac6fb01b0d7a73e3cc5894fcb60f002 /net/ipv4/tcp_input.c
parentb979f780bfe70f299455bf9e10f206cb58951b6c (diff)
thermal-core: Use rcu for accessing sensor list
Sensor temperature read function traverses the sensor list every time without using any lock. If the list is undergoing mutation when it is traversed, it may result in memory violation. For example, the new element could have added to the list before updating the next pointer due to out of order execution. This could result in either NULL pointer dereference or unassigned memory access violation. Using a lock every time when temperature is read may mutually exclude it from list mutation, but it impacts the performance. Sensor addition is an infrequent operation when compared to sensor temperature read. So adding a lock to protect against this infrequent operation will add overhead and deter performance. Use of list_for_each_entry_safe() function for traversing, won't help. Because this function can help only if the traversal loop removes the current element, that is pointed by this iteration. Use RCU when traversing and updating the list to avoid locks. RCU ensures list traversal safe addition or deletion happens and doesn't block the frequent read operation. Replace the list_for_each_entry_safe() function with rcu safe list traversal function list_for_each_entry_rcu(), wherever it is applicable. Change-Id: I4c05fefa6906ecad408dfd4407b60bc051366f8c Signed-off-by: Ram Chandrasekar <rkumbako@codeaurora.org>
Diffstat (limited to 'net/ipv4/tcp_input.c')
0 files changed, 0 insertions, 0 deletions