It is called from an ISR. (Interrupt Service Routine)
Most likely it is called from:
OTG_HS_IRQHandler.
(with several levels of functions inbetween).
Here is a copy of my stack inside of a breakpoint.
CDC_Receive_HS() at usbd_cdc_if.c:456 0x801c758
USBD_CDC_DataOut() at usbd_cdc.c:699 0x8031592
USBD_LL_DataOutStage() at usbd_core.c:331 0x80318aa
HAL_PCD_DataOutStageCallback() at usbd_conf.c:249 0x801e486
HAL_PCD_IRQHandler() at stm32f7xx_hal_pcd.c:359 0x802d264
OTG_HS_IRQHandler() at stm32f7xx_it.c:288 0x801ab74
You most likely do NOT need to disable other interrupts just to copy this data to another buffer. I believe the buffer it uses should only be used by the usb receive. Copy the data to a separate buffer. The new buffer will need concurrency protection when used outside of this interrupt.
If you are using FreeRTOS, I recommend using the "xQueue" type as a buffer. It is thread safe. You use xQueueSendToBackFromISR inside of interrupts and xQueueSendToBack outside of interrupts.