aboutsummaryrefslogtreecommitdiff
path: root/kernel/locking/lockdep.c
diff options
context:
space:
mode:
authorAmit Pundir <amit.pundir@linaro.org>2017-11-20 21:48:45 +0530
committerAmit Pundir <amit.pundir@linaro.org>2017-11-20 21:48:45 +0530
commitbaa6b7f93aec81644160ca02a8a6a5ae3be4ce85 (patch)
tree2a6bf027912ae74a354ce3b7d460d04ccfac4e55 /kernel/locking/lockdep.c
parent7bc703cde6592016ed3eadd8bd592ee9adbe6647 (diff)
parentf409333f361fed0c71c479b2a0c4e032d496cd94 (diff)
Merge branch 'linux-linaro-lsk-v3.18' into linux-linaro-lsk-v3.18-androidlsk-v3.18-18.03-androidlsk-v3.18-18.02-androidlsk-v3.18-17.11-androidlinux-linaro-lsk-v3.18-android
Conflicts: net/packet/af_packet.c Fix conflicts by refactoring changes from LTS commit e4ffdf9ead59 ("packet: hold bind lock when rebinding to fanout hook"), to align with the changes from AOSP commit 6bec212418d2 ("UPSTREAM: packet: fix races in fanout_add()"). Signed-off-by: Amit Pundir <amit.pundir@linaro.org>
Diffstat (limited to 'kernel/locking/lockdep.c')
-rw-r--r--kernel/locking/lockdep.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/kernel/locking/lockdep.c b/kernel/locking/lockdep.c
index 88d0d4420ad2..3467618cc0ea 100644
--- a/kernel/locking/lockdep.c
+++ b/kernel/locking/lockdep.c
@@ -3107,10 +3107,17 @@ static int __lock_acquire(struct lockdep_map *lock, unsigned int subclass,
if (depth) {
hlock = curr->held_locks + depth - 1;
if (hlock->class_idx == class_idx && nest_lock) {
- if (hlock->references)
+ if (hlock->references) {
+ /*
+ * Check: unsigned int references:12, overflow.
+ */
+ if (DEBUG_LOCKS_WARN_ON(hlock->references == (1 << 12)-1))
+ return 0;
+
hlock->references++;
- else
+ } else {
hlock->references = 2;
+ }
return 1;
}