Shaving cream and hairspray are allowed if they are under the sizes above.
The following are in the allowed column
Toilet or medicinal articles that are hazardous materials such as rubbing alcohol, flammable perfume and colognes, nail polish and remover, and aerosols (hairspray, shaving cream, etc.).
The following is in the not allowed column
Hazardous materials that are not medicinal/toilet articles or described in the other exceptions, such as: spray paints, aerosol laundry starch, insecticides, drain cleaners, camping fuel, etc.
also allowed, with a picture of a can of reddi wip from the FAA's website
Non-toiletry aerosols that contain nonflammable & non-toxic gas –in checked baggage only.
If you check the airlines websites for aerosols, you will find things like (United)
Liquids, gels and/or aerosols (including duty-free items) purchased in the boarding area are permitted onboard the aircraft.
and from American
Example
Aerosol deodorant/hair spray/insect repellent, perfume/cologne containing alcohol, nail polish, nail polish remover, large bottles of acetone such as liquid nails
Allowed For Travel?
Yes
and from Delta
Delta will accept personal care items, such as cologne and hairspray in checked baggage, if less than 17 ounces of each item and less than 70 ounces total without prior approval.
Some aerosols are allowed, and some are not in checked bags. They are not all prohibited.