2. For non-zero vectors $a$ and $b$, there are two propositions.

Proposition A: $a \perp b$;
Proposition B: The function $f(x)=(x a+b) \cdot(x b-a)$ is a linear function.
Then A is B's ( ) condition.
(A) sufficient but not necessary
(B) necessary but not sufficient
(C) sufficient and necessary
(D) neither sufficient nor necessary
2. B.

Notice
$$
\begin{array}{l}
f(x)=a \cdot b x^{2}+\left(b^{2}-a^{2}\right) x-a \cdot b, \\
a \perp b \Leftrightarrow a \cdot b=0 .
\end{array}
$$

Thus, $f(x)$ is a linear function $\Rightarrow a \cdot b=0$.
However, when $\boldsymbol{a} \cdot \boldsymbol{b}=0$, $f(x)$ could be a constant function, not necessarily a linear function.