Linear Cryptanalysis of hash function
As @MaartenBodewes stated in the comments, just one method of cryptanalysis cannot show a hash function is secure.

Your question


  My doubt is: Is this method right? What bits of the input and output i have to include in the linear approximation, all?


has the following answer. In general, while doing linear cryptanalysis we try all possible subsets of input and output bits and look for biases in the resulting expressions. Thus there is a total of $2^{n+m}-1$ possible expressions to check.

Let $(a_1,\ldots,a_n) \in \{0,1\}^n,$ and $(b_1,\ldots,b_m)\in \{0,1\}^m.$ Then except for the case $(b_1,\ldots,b_n)=(0,\ldots,0)$ all the following expressions
$$
a_1 x_1 \oplus a_2 x_2 \oplus \cdots \oplus a_n x_n \oplus b_1 y_1\oplus \cdots \oplus b_m y_m
$$
need to be computed and their biases tested. We rule out $(b_1,\ldots,b_n)$ being zero since then then we're not computing anything interesting about the output of the hash function, but it is OK to let $(a_1,\ldots,a_n)$ zero since that tests the overall balance of the function, regardless of input.

In terms of more general analysis, there are obviously many other techniques, differential cryptanalysis, looking for collisions, looking for inverse images, etc. the latter two being directly related to hash function goals.