diff options
author | Stefan Metzmacher <metze@samba.org> | 2015-06-02 00:15:11 +1000 |
---|---|---|
committer | Amitay Isaacs <amitay@samba.org> | 2015-06-12 12:40:54 +0200 |
commit | 752ec31bcbbfe9f5b3b1c5dde4179d69f41cb53c (patch) | |
tree | 04f870ae3c2fdce69ed4a4624539d278d0484ee4 | |
parent | ee02e40e869fd46f113d016122dd5384b7887228 (diff) | |
download | samba-752ec31bcbbfe9f5b3b1c5dde4179d69f41cb53c.tar.gz |
ctdb-locking: Set the lock_ctx->request to NULL when request is freed
The code was added to ctdb_lock_context_destructor() to ensure that
the if a lock_ctx gets freed first, the lock_request does not have a
dangling pointer. However, the reverse is also true. When a lock_request
is freed, then lock_ctx should not have a dangling pointer.
In commit 374cbc7b0ff68e04ee4e395935509c7df817b3c0, the code for second
condition was dropped causing a regression.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=11293
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
-rw-r--r-- | ctdb/server/ctdb_lock.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/ctdb/server/ctdb_lock.c b/ctdb/server/ctdb_lock.c index 8c45a442e5a..d5eb7176813 100644 --- a/ctdb/server/ctdb_lock.c +++ b/ctdb/server/ctdb_lock.c @@ -312,7 +312,13 @@ static int ctdb_lock_context_destructor(struct lock_context *lock_ctx) */ static int ctdb_lock_request_destructor(struct lock_request *lock_request) { + if (lock_request->lctx == NULL) { + return 0; + } + + lock_request->lctx->request = NULL; TALLOC_FREE(lock_request->lctx); + return 0; } |