Baby picked up by legs

I had laid my baby on the couch next to my mom for a minute while I made his bottle, I walk back in and my brother picked him up by his legs and my son was hanging upside down. It was only for a second but I'm worried that it could have hurt him. I was so pissed and yelling at him but I think my yelling scared my baby more than the hanging by his feet did. He cried for a few minutes but isn't acting any different. Oh and he's 3 months old