To answer a question we presented in a previous post...
The Maharsha on the gemara in Chagiga [16] says that the gemara forbids one to learn from both a Rebbe who is deficient in middos and also one whose emunah is lacking. [The Rambam just writes that he is going בדרך לא טובה - without specifying what that means]. Unfortunately, I have met both types and they are dangerous because they can do a lot of harm. Fortunately, MOST Rabbeim are people of fine character and complete belief in Hashem and His Torah.
There is also a discussion in the poskim about reading the sfarim of Rabbeim whose character and/or emunah leave much to be desired. The discussion only begins if the sfarim themselves are worthy of being learned. There are those who permit and those who forbid [quoted by the Sdei Chemed].