upstream commit a0f47344e286768e3ce96268eed1ad0f6cfd9f2c