diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2011-07-25 14:15:50 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2011-07-25 14:15:50 -0400 |
commit | e13889bab3c6b5c839075086d28fe05f71984dda (patch) | |
tree | 4b2931575f48186533848f36a7c80809ea929097 | |
parent | eda65cc6ce2a45dc01c233e301e59cd7a0f763ad (diff) |
fix devtmpfs race
After we's done complete(&req->done), there's nothing to prevent the
scope containing *req from being gone and *req overwritten by any
kind of junk. So we must read req->next before that...
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
-rw-r--r-- | drivers/base/devtmpfs.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/base/devtmpfs.c b/drivers/base/devtmpfs.c index 6d678c99512e..b89fffc1d777 100644 --- a/drivers/base/devtmpfs.c +++ b/drivers/base/devtmpfs.c | |||
@@ -406,9 +406,10 @@ static int devtmpfsd(void *p) | |||
406 | requests = NULL; | 406 | requests = NULL; |
407 | spin_unlock(&req_lock); | 407 | spin_unlock(&req_lock); |
408 | while (req) { | 408 | while (req) { |
409 | struct req *next = req->next; | ||
409 | req->err = handle(req->name, req->mode, req->dev); | 410 | req->err = handle(req->name, req->mode, req->dev); |
410 | complete(&req->done); | 411 | complete(&req->done); |
411 | req = req->next; | 412 | req = next; |
412 | } | 413 | } |
413 | spin_lock(&req_lock); | 414 | spin_lock(&req_lock); |
414 | } | 415 | } |