Buckling or wet ceiling drywall, as well as cracks in the ceiling and flaking paint, are signs of a leak, and if the upstairs bathroom is nearby, the leak is probably from there. You'll have to remove some of the drywall to find the exact source of the leak, and you won't always be able to fix it yourself. The problem is often a loose shower or tub drain, however, and that is a repair you can do. If you discover water spraying from a water pipe or a crack in the tub or shower base, you probably need a plumber.
Turn off the breakers controlling any light fixtures in the ceiling. The leak creates a dangerous ground fault situation, and someone could get a shock by touching the wet drywall.
Cut out all the damaged drywall with a drywall saw. The best way to do this is to cut a rectangular section that encloses the entire damaged area; a rectangular shape is easier to patch than a round or irregular one.
Shine a flashlight into the space between the ceiling and upstairs floor and look for dripping or spraying water. If the drain pipes for the shower or bathtub are accessible, feel them with your hand. If they're wet, the drain is leaking or there's a crack in the tub or shower base. If water is spraying, one of the water pipes is leaking; turn off the water supply to the pipe at the nearest shutoff valve or at the main shutoff valve for the house, and call a plumber to have the pipe repaired.
Test the tub or shower base by covering the drain, including the edges of its metal flange, with duct tape and pouring in enough water to cover it by an inch. Go downstairs and look for dripping water. If you see any, it means there's a crack in the tub or shower, and you'll probably need a contractor to fix it. If no water is dripping, however, the leak is coming from the drain, and that isn't difficult to repair.
Pull off the drain grid with a flat-head screwdriver; you may have to remove some screws with a Phillips screwdriver first. Obtain a drain key, which is a specialized tool for removing tub and shower drains, insert it into the drain and tighten it against the sides. Turn it counterclockwise to unscrew the drain from the drain shoe.
Clean all the dried putty from the threads on the drain and from inside the drain shoe, using a wire brush, and inspect the drain. It may be cracked, or the threads may be stripped. If so, replace it with a new one.
Spread new plumber's putty on the underside of the flange of the drain and screw it back into the shoe. Tighten it with the drain key until the edge of the flange makes contact with the tub or shower base.
Close the stopper, fill the tub or shower pan with an inch of water, then go downstairs and check for leaks. If you see water, tighten the drain a bit more until it stops.