From ca73ba859ed91f272504c31d1f56f9315b7ef5c0 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Thu, 20 Jun 2019 12:42:23 +0200 Subject: [PATCH] smbd: Add some paranoia against NULL dereference Quite a few callers set "psmblctx" to NULL, and I could not really follow 100% that brl_lock only assigns that in the blocking lock case. Too many layers :-) Signed-off-by: Volker Lendecke Reviewed-by: Jeremy Allison --- source3/locking/locking.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/source3/locking/locking.c b/source3/locking/locking.c index 9d9476db19c..969be706147 100644 --- a/source3/locking/locking.c +++ b/source3/locking/locking.c @@ -247,6 +247,7 @@ struct byte_range_lock *do_lock(struct messaging_context *msg_ctx, { struct byte_range_lock *br_lck = NULL; struct server_id blocker_pid; + uint64_t blocker_smblctx; /* silently return ok on print files as we don't do locking there */ if (fsp->print_file) { @@ -288,7 +289,11 @@ struct byte_range_lock *do_lock(struct messaging_context *msg_ctx, lock_flav, blocking_lock, &blocker_pid, - psmblctx); + &blocker_smblctx); + + if (psmblctx != NULL) { + *psmblctx = blocker_smblctx; + } DEBUG(10, ("do_lock: returning status=%s\n", nt_errstr(*perr))); -- 2.47.3