Go under the bathroom floor if possible by going into a crawlspace or basement underneath it. Ask a helper to walk across the bathroom floor while you do this so you can inspect the flooring and the joists. Measure any gaps between the joist and the flooring with a ruler.
Cut a cedar shingle with a utility knife so it fits into the gap you just measured. They make ideal shims because of both their durability once installed and the ease with which they can be cut or molded.
Apply carpenter's glue to the shingle piece using a soft brush. Push it into the gap between the joist and the bathroom subfloor. Tap it further into place with a rubber mallet. If the shim is too thin, glue another piece of shingle to it so it is wider.
Drill a drywall screw at an angle into the joist, the shim and the subfloor so it connects all three. This adds stability so your repair lasts longer and the shim doesn't come loose.