From 0e894f3e48285415f72cf7a68e26f1802fe8045d Mon Sep 17 00:00:00 2001 From: Ralph Boehme Date: Mon, 9 Mar 2020 11:54:28 +0100 Subject: [PATCH] vfs_default: pass in state as the callback data to the subreq Find the req we're finishing off by looking inside the state. In a shutdown close the caller calls talloc_free(req), so we can't access it directly as callback data. The next commit will NULL out the state->req pointer when a caller calls talloc_free(req), and the request is still in flight. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14301 Signed-off-by: Ralph Boehme Reviewed-by: Jeremy Allison --- source3/modules/vfs_default.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/source3/modules/vfs_default.c b/source3/modules/vfs_default.c index fac7fa30ab7..bd39eb47e9a 100644 --- a/source3/modules/vfs_default.c +++ b/source3/modules/vfs_default.c @@ -3408,7 +3408,7 @@ static struct tevent_req *vfswrap_getxattrat_send( if (tevent_req_nomem(subreq, req)) { return tevent_req_post(req, ev); } - tevent_req_set_callback(subreq, vfswrap_getxattrat_done, req); + tevent_req_set_callback(subreq, vfswrap_getxattrat_done, state); talloc_set_destructor(state, vfswrap_getxattrat_state_destructor); @@ -3503,10 +3503,9 @@ end_profile: static void vfswrap_getxattrat_done(struct tevent_req *subreq) { - struct tevent_req *req = tevent_req_callback_data( - subreq, struct tevent_req); - struct vfswrap_getxattrat_state *state = tevent_req_data( - req, struct vfswrap_getxattrat_state); + struct vfswrap_getxattrat_state *state = tevent_req_callback_data( + subreq, struct vfswrap_getxattrat_state); + struct tevent_req *req = state->req; int ret; bool ok; -- 2.47.2