How to Repair Wobbly Banister Post
Assuming that the framing around the post socket is solid, this is what I'd do for a rock-solid result:


Procure some items:


Heavy-duty construction adhesive--the kind that comes in a caulking gun tube. Liquid Nails in blue/gold is what I have in mind. 
Wood shims. 6" are ok. 8" are better.
A bubble level in the 2-4' range
Utility knife with a fresh blade
Masking tape and plastic or paper
Vacuum cleaner

Protect the carpeting and post with masking tape, plastic, or whatever. Once solvent-based adhesive goes on, it doesn't come off without effort. 
Clean all loose material out of the gap. Use tools to eliminate old shims, dust, etc. Use a vacuum to clean it out well.
Squeeze that gap as full as you can with construction adhesive. Obviously you don't want it dripping out the bottom onto something important, so check that. 
Start gently tapping shims into the gap in reversed pairs, seeking to coat them with adhesive. Pre-apply adhesive if you like. The idea here is to create support not just at the top of the gap, but 4 inches or more down the post. If the shims are too thick, cut the lower one in half and use the thin part. 
Check plumb with the level. Adjust shims as needed, and continue to tap them in. Be sure that shims or glue or (ideally) both are snugging up down in the gap.
Once you have most of the gap filled with shims, do a final check for plumb, then slice the shims off flush with the hard floor. Scrape off any adhesive that remains outside the gap. 
Protect the post from force for 48 hours.


The combination of adhesive and wood shims will leave a solid, well-bonded base for your post. The adhesive will continue to harden over the following weeks.