Yes fine for small patches, whole ceiling use Zinsser Bullseye 123. You may have some "flashing" that is the treated area when painted with topcoat might look different in certain lights due to the undercoat being applied by spray not roller, but a couple of coats usually sorts that out. Best to go over the treated area once then give the whole ceiling a coat or two depending on how good the existing paint finish is.
Also not unusual for the stain to come through the first coat of stain blocker but it will then stay locked in and a second coat of blocker will cover it fine, that's just how they work.