upstream commit 3a4ba0c3964f8f0ecc2dd46246a83258d9e4046d