A linear extension theorem