If your response when she starts this behavior is to scold her (attention), try to push her away (touch is attention), or pull your arms and purse out of her mouth (tug-of-war and attention), your message isn’t being received – you’ve created a great game for the dog.
You don’t mention what breed of dog you have, but I’m betting it’s a retriever of some sort. These dogs tend to be a bit more oral that a lot of other breeds. You’ll want to have a stash of soft toys in your garage, so you can grab one before entering the house. When you walk in the door, pretend you don’t even have a dog: Make no eye contact, don’t talk to her (even scolding is attention), and definitely don’t pet her. As she moves in closely, stuff that toy into her mouth. What will likely happen is she will bounce around in her continued excitement to see you, but be chomping on that toy all the while.
Next, move past her into the rest of the house, pretending she doesn’t exist. Even if she follows you, chomping on her toy, pay no attention. The time to interact with your dog directly is when her body language suggests that she is no longer over-stimulated. She might lie down, might even quit mouthing the toy, and will probably move away from you. Then, when she is calm and you are ready, go over to her and quietly, gently pet and interact with her.
Over time, a new routine will evolve: You walk in the door, the dog eagerly awaits the toy you give her, she moves away chomping on it, and settles down calmly within seconds.
This situation will resolve over time, as long as you create the right set up. One option is to wear shoes for a while, and each time you begin your walk down the hallway, stop before she gets to you. Don’t interact with her in any way, and don’t move your feet. Dogs aren’t terribly patient creatures, and if you stand there, still and quiet, she likely will give up quickly, and move on to find something else to do. When she does, you can continue to walk down the hallway, but be prepared to stop again when she comes back, hoping for the game to return.
Another option is to have a couple of pieces of cardboard on hand, large enough to block her access to you when walking down the hall. They should be nearly as wide as the hallway. Place one piece at each end of the hallway, so you always have one within reach. Pick up a piece of cardboard and hold it behind you as you begin to move, making it impossible for your dog to get at your socks, and thus ruining the game for her. Over time, you’ll have created a new pattern of behavior in her – she won’t be following you down the hallway any longer, because it is no longer possible to get a game of “sock grab” going.
Beware that scolding her directly, trying to pull your foot or sock out of her mouth, or kicking her away with your foot will not give you the solution to this situation. Those approaches will only intensify the game, and your dog will learn to come at your socks faster, and with more bite pressure. A quick correction won’t properly address this issue; a thoughtful plan of action that includes some repetition will end it for good.