STM32Cube_FW_F4_V1.18.0 module stm32f4xx_hal_dcmi.c has a bug in HAL_DCMI_Stop such that when the 'count' variable is decremented to zero (to indicate a timeout), the loop continues.
I reckon there should be a 'break;' after the line
status = HAL_TIMEOUT;
Discovered after I lost vsync from a camera, tried to stop it and an hour later was still waiting!!