upstream commit 2990b787dcb28abe997c6c7640e3986f0db58728