out of three possible rotational degrees of freedom, only two are applicable to our linear molecule. The third rotation can't be accessed and is 'frozen out'. Thus a linear molecule is said to have two rotational degrees of freedom, as this third parameter would give us no extra information about the system.
Non-linear molecules have 3N degrees of freedom in total. We know 3 are translational, 3 are rotational (all are allowed for non-linear molecules) so the remaining 3N-6 are vibrational.
Linear molecules have 3 translational and only 2 rotational, and to keep a total of 3N degrees of freedom, they now need 3N-5 vibrational.
Why does the 'frozen' out rotational degree of freedom for linear molecules not count? As stated above, knowledge of it gives no extra information about the system, but at what point does a degree of freedom count as 'frozen out' and need to be compensated for by other (vibrational)