]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
smbd: Add some paranoia against NULL dereference
authorVolker Lendecke <vl@samba.org>
Thu, 20 Jun 2019 10:42:23 +0000 (12:42 +0200)
committerJeremy Allison <jra@samba.org>
Thu, 20 Jun 2019 17:18:18 +0000 (17:18 +0000)
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 <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/locking/locking.c

index 9d9476db19c581b0bc043254e8ae916d853aaf5c..969be7061471c7fff35efc3e1581927385a50bf0 100644 (file)
@@ -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)));