[PATCH] autofs4 - atomic var underflow - obvious programming error

From: Ian Kent
Date: Sun Mar 26 2006 - 06:38:02 EST



Hi Andrew,

Here is the patch I have for the underflow of reported recently.

It looks like an obvious programming error on my part (as usual).

Signed-off-by: Ian Kent <raven@xxxxxxxxxx>

--

--- linux-2.6.16-rc6-mm1/fs/autofs4/waitq.c.notify-bug 2006-03-13 13:23:52.000000000 +0800
+++ linux-2.6.16-rc6-mm1/fs/autofs4/waitq.c 2006-03-13 13:25:40.000000000 +0800
@@ -263,7 +263,7 @@ int autofs4_wait(struct autofs_sb_info *
wq->tgid = current->tgid;
wq->status = -EINTR; /* Status return if interrupted */
atomic_set(&wq->wait_ctr, 2);
- atomic_set(&wq->notified, 1);
+ atomic_set(&wq->notify, 1);
mutex_unlock(&sbi->wq_mutex);
} else {
atomic_inc(&wq->wait_ctr);
@@ -273,9 +273,11 @@ int autofs4_wait(struct autofs_sb_info *
(unsigned long) wq->wait_queue_token, wq->len, wq->name, notify);
}

- if (notify != NFY_NONE && atomic_dec_and_test(&wq->notified)) {
+ if (notify != NFY_NONE && atomic_read(&wq->notify)) {
int type;

+ atomic_dec(&wq->notify);
+
if (sbi->version < 5) {
if (notify == NFY_MOUNT)
type = autofs_ptype_missing;
--- linux-2.6.16-rc6-mm1/fs/autofs4/autofs_i.h.notify-bug 2006-03-13 13:23:39.000000000 +0800
+++ linux-2.6.16-rc6-mm1/fs/autofs4/autofs_i.h 2006-03-13 13:24:08.000000000 +0800
@@ -85,7 +85,7 @@ struct autofs_wait_queue {
pid_t tgid;
/* This is for status reporting upon return */
int status;
- atomic_t notified;
+ atomic_t notify;
atomic_t wait_ctr;
};

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/