6. Given that $a, b, c, d$ are all real numbers, the function
$$
f(x)=\frac{a}{3} x^{3}+\frac{b}{2} x^{2}+c x+d \quad (a<0)
$$

has two critical points $x_{1}, x_{2} \left(x_{1}<x_{2}\right)$, satisfying $f\left(x_{2}\right)=x_{1}$. Then the equation
$$
a f^{2}(x)+b f(x)+c=0
$$

has ( ) real roots.
(A) 0
(B) 2
(C) 3
(D) 4
6. C.

Notice that, $f^{\prime}(x)=a x^{2}+b x+c$.
Given $a<0, x_{1}<x_{2}$, then $f(x)$ is monotonically decreasing on the interval $\left(-\infty, x_{1}\right)$, monotonically increasing on the interval $\left(x_{1}, x_{2}\right)$, and monotonically decreasing on the interval $\left(x_{2},+\infty\right)$, and
$$
a x_{1}^{2}+b x_{1}+c=0, a x_{2}^{2}+b x_{2}+c=0 .
$$

If $f(x)=x_{1}$, at this point, the equation has two roots; if $f(x)=x_{2}$, at this point, the equation has one root.
In summary, the equation should have three real roots.