upstream commit c786f85ea2495ca8ae239fb9575fbc1d85fb381e