I will be either sitting on the sofa, or walking up the stairs, and Marley will come along and literally lunge at me, biting my feet and legs.

I'm semi-sure he's playing, but it's rather painful. I've tried giving him a stern "NO!", but it doesn't work.

His fur gets all puffy, and his ears go back, so maybe he really is in attack mode?

Does anyone else's cat do this? Any ideas on what I can do to get him to stop?