smbd: reset dangling watch_req pointer in poll_open_done
authorRalph Boehme <slow@samba.org>
Wed, 17 Mar 2021 15:22:37 +0000 (16:22 +0100)
committerKarolin Seeger <kseeger@samba.org>
Wed, 31 Mar 2021 10:13:54 +0000 (10:13 +0000)
commitda71738e987310f19d63d2b575c354156dadbf8f
treec4c973547bdd6f3e9fc05327a45a146f2296abb7
parent288c747208318a067836ed74afa138ae7b261464
smbd: reset dangling watch_req pointer in poll_open_done

We just freed subreq and a pointer to subreq is stored in open_rec->watch_req,
so we must invalidate the pointer.

Otherwise if the poll open timer fires it will do a

  TALLOC_FREE(open_rec->watch_req);

on the dangling pointer which may crash or do something worse like freeing some
other random talloc memory.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14672
CI: https://gitlab.com/samba-team/samba/-/merge_requests/1843

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit 065ed088b3d5710c288e46a5bf1e063f9a29c8cc)
source3/smbd/open.c