Q. Can one hug and kiss a young child that fell and hurt himself while in shul, to calm him and keep him from crying, when it is difficult to take him out somewhere else?
A. Horav Y. Zilberstein Shlit’a (Aleinu Leshaveach – Shemos p. 579) prohibits kissing a bar mitzva boy in shul after he finishes the haftora or reading the Torah etc. (See question 2459 above).
However, he permits kissing a young child that fell and hurt himself while in shul, since it is not done as a loving act, but just to calm down and tranquilize the infant.
Horav Shlomo Miller’s opinion is similar.
Rabbi A. Bartfeld as revised by Horav Shlomo Miller Shlit’a