The scholars have outlined a number of occasions when speaking about someone does not constitute backbiting. One is when a person informs about the disobedience of another to help others safeguard against the evil. The evidence for it is the following Hadith:
Narrated Abu Waqid Al-Laithi:
While Allah's Messenger (sallallaahu alayhi wa sallam) was sitting in the mosque with some people, three men came. Two of them came in front of Allah's Messenger (sallallaahu alayhi wa sallam) and the third one went away. The two persons kept on standing before Allah's Messenger (sallallaahu alayhi wa sallam) for a while and then one of them found a place in the circle and sat there while the other sat behind the gathering, and the third one went away. When Allah's Messenger (sallallaahu alayhi wa sallam) finished his preaching, he said, "Shall I tell you about these three persons? One of them betook himself to Allah, so Allah took him into His grace and mercy and accommodated him, the second felt shy from Allah, so Allah sheltered Him in His mercy (and did not punish him), while the third turned his face from Allah and went away, so Allah turned His face from him likewise."
[Sahih Al-Bukhaari Hadith No. 65]
Dr. Muusaa Shaahiin Laashiin says on Page 45 in his book al-manhal al-hadiith [المنهل الحديث]
[From this Hadith we come to know] of the permissibility of informing about those who are disobedient and their state of being for the purpose of preventing [others] from it [i.e the disobedience]. And that that is not considered gheebah [backbiting].