From: John Wolfe Date: Tue, 13 Sep 2022 17:31:15 +0000 (-0700) Subject: Add a null undo function to the vmbackup null provider. X-Git-Tag: stable-12.2.0~86 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=abd63f3785f8e4ec5384f55021b070be22c7cf8f;p=thirdparty%2Fopen-vm-tools.git Add a null undo function to the vmbackup null provider. If a snapshot operation times out, vmbackup can attempt to undo quiescing. Since no quiescing is done for the null backup provider, no undo function was provided. If vmbackup attempts to call the undo function, it dereferences a garbage pointer resulting in a segfault. Rather than add null backup provider specific checks to vmbackup, this change adds a null undo function to provide vmbackup with a valid function pointer it can call. The new undo function updates the vmbackup state machine state with a new currentOpName, but has no other effect. currentOpName is set to the calling function name, e.g. __FUNCTION__. --- diff --git a/open-vm-tools/services/plugins/vmbackup/nullProvider.c b/open-vm-tools/services/plugins/vmbackup/nullProvider.c index 1abc5f606..e07d2b72b 100644 --- a/open-vm-tools/services/plugins/vmbackup/nullProvider.c +++ b/open-vm-tools/services/plugins/vmbackup/nullProvider.c @@ -1,5 +1,5 @@ /********************************************************* - * Copyright (C) 2010-2016 VMware, Inc. All rights reserved. + * Copyright (C) 2010-2016, 2022 VMware, Inc. All rights reserved. * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as published @@ -243,6 +243,32 @@ VmBackupNullSnapshotDone(VmBackupState *state, return TRUE; } + +/* + ****************************************************************************** + * VmBackupNullUndo -- */ /** + * + * Update the state machine state with the currentOpName. + * + * Can be called when snapshot times out. See PR2993571 and PR3003917. + * + * @param[in] state the backup state + * @param[in] clientData client data + * + * @return TRUE + * + ****************************************************************************** + */ + +static Bool +VmBackupNullUndo(VmBackupState *state, + void *clientData) +{ + g_debug("*** %s\n", __FUNCTION__); + VmBackup_SetCurrentOp(state, NULL, NULL, __FUNCTION__); + return TRUE; +} + #endif /* @@ -281,6 +307,9 @@ VmBackup_NewNullProvider(void) provider = g_new(VmBackupSyncProvider, 1); provider->start = VmBackupNullStart; +#if !defined(_WIN32) + provider->undo = VmBackupNullUndo; +#endif provider->snapshotDone = VmBackupNullSnapshotDone; provider->release = VmBackupNullRelease; provider->clientData = NULL;