This is a non-homogeneous linear differential equation. After multiplying by #x^2# we get

#x^2y'+(x^2-1)y = x^3+x^2-x#

Considering the homogeneous solution

#x^2y'_h+(x^2-1)y_h=0# which is separable, we get at

#(dy_h)/(y_h) = -(x^2-1)/x^2 dx# and after integrating both sides

#log_e y_h = -(1/x+x+C_1)# and then

#y_h=C_2 e^(-x-1/x)#

For the particular solution we make #y_p = C_2(x)e^(-x-1/x)# and after substituting into the complete equation we get

#x (1 - x (1 + x) + e^(- x-1/x) x C_2'(x)) = 0#

or

#C_2'(x) =(e^(1/x + x) (-1 + x + x^2))/x # and integrating

#C_2(x) = xe^(1/x+x)+C_3 # and finally

#y = y_h+y_p = e^(-x-1/x)(xe^(1/x+x)+C_3) = x + C_3 e^(-x-1/x)#