Linear polarization in the nucleus of M87 at 7 mm and 1.3 cm