Commit 3e7b19198003fc25b11838e709f17d4fa173b2d7
Committed by
Linus Torvalds
1 parent
871f94344c
Exists in
master
and in
7 other branches
[PATCH] autofs4: atomic var underflow
Fix accidental underflow of the atomic counter. Signed-off-by: Ian Kent <raven@themaw.net> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Showing 2 changed files with 5 additions and 3 deletions Side-by-side Diff
fs/autofs4/autofs_i.h
fs/autofs4/waitq.c
... | ... | @@ -263,7 +263,7 @@ |
263 | 263 | wq->tgid = current->tgid; |
264 | 264 | wq->status = -EINTR; /* Status return if interrupted */ |
265 | 265 | atomic_set(&wq->wait_ctr, 2); |
266 | - atomic_set(&wq->notified, 1); | |
266 | + atomic_set(&wq->notify, 1); | |
267 | 267 | mutex_unlock(&sbi->wq_mutex); |
268 | 268 | } else { |
269 | 269 | atomic_inc(&wq->wait_ctr); |
270 | 270 | |
... | ... | @@ -273,8 +273,10 @@ |
273 | 273 | (unsigned long) wq->wait_queue_token, wq->len, wq->name, notify); |
274 | 274 | } |
275 | 275 | |
276 | - if (notify != NFY_NONE && atomic_dec_and_test(&wq->notified)) { | |
276 | + if (notify != NFY_NONE && atomic_read(&wq->notify)) { | |
277 | 277 | int type; |
278 | + | |
279 | + atomic_dec(&wq->notify); | |
278 | 280 | |
279 | 281 | if (sbi->version < 5) { |
280 | 282 | if (notify == NFY_MOUNT) |