Plugging a=b=0 yields f2(0)≤0, hence f(0)=0. Again, plugging b=0, and then a=0, we obtain f(a2)≤af(a), ∀a∈R and f(b2)≥bf(b), ∀b∈R, therefore f(x2)=xf(x), ∀x∈R. Replacing the latter in the given equation, we get f(a)f(b)≤ab, ∀a,b∈R.
Also, −xf(−x)=f((−x)2)=f(x2)=xf(x), hence f is an odd function.
The last two relations give f(a)f(b)=−f(a)f(−b)≥−(−ab)=ab, so f(a)f(b)=ab, ∀a,b∈R.
Thus, f2(1)=1, which implies f(1)=±1 and either f(x)=x,∀x∈R, or f(x)=−x,∀x∈R.
It is easy to check that both functions are solutions of the problem.