Sales rise 7% as Masco swings to profit in Q2