We may as well work locally on $M$ and so assume our vector bundles are trivial. So let us say we have a map of sheaves $\phi:F\to G$ where $F=(C^\infty M)^m$ and $G=(C^\infty M)^n$, which we can represent as multiplication by an $n\times m$ matrix $(\phi_{ij})$ of smooth functions on $M$. Let $K$ be the cokernel sheaf of $\phi$. I first claim that the dimension of the fiber of $K$ at a point $x$ is $n$ minus the rank of the matrix $(\phi_{ij}(x))$.
Indeed, the exact sequence of sheaves $F\to G\to K \to 0$ gives an exact sequence of fibers $F|_x\to G|_x\to K|_x\to 0$ (taking fibers is right exact). We can identify $F|_x$ and $G|_x$ with $\mathbb{R}^m$ and $\mathbb{R}^n$ and then the map between them is just given by the matrix $(\phi_{ij}(x))$. So, the dimension of $K|_x$ is just the dimension $n$ of $G|_x$ minus the rank of this matrix.
It follows that the dimension of $K|_x$ is upper semicontinuous: for each $r$, the set of $x\in M$ such that $K|_x$ has dimension at most $r$ is open. Now I claim that if the stalk $K_x$ is free, then the dimension of the fiber is actually also lower semicontinuous at $x$. That is, letting $r$ be the dimension of $K|_x$, I claim there is a neighborhood $U$ of $x$ such that $K|_y$ has dimension at least $r$ for all $y\in U$.
To prove this, suppose it is not true, so we have a sequence of points $y_k$ approaching $x$ such that $K|_{y_k}$ has dimension at most $r-1$ for each $k$. That means the matrix $(\phi_{ij}(y_k))$ has rank at least $n-r+1$ for each $k$. For each $k$, choose sections $f_{0k},f_{1k},\dots,f_{(n-r)k}$ of $F$ in a neighborhood of $y_k$ such that the vectors $\phi(f_{ik})(y_k)$ are linearly independent.
Now we are assuming $K_x$ is free and $K|_x$ is $r$-dimensional, so $K_x$ has rank $r$. In particular, we can find sections $g_1,\dots,g_r$ of $G$ in some neighborhood $U$ of $x$ whose images in $K_x$ are linearly independent. We assume for convenience that $y_k\in U$ for all $k$.
Now note that since the $\phi(f_{ik})$ are linearly independent at $y_k$, they are also linearly independent in a neighborhood of $y_k$. So, looking in a small neighborhood of $y_k$, we have $n+1$ sections $\phi(f_{0k}),\dots,\phi(f_{(n-r)k}),g_1,\dots,g_r$ of $G=(C^\infty M)^n$, so they must be linearly dependent. Since the $\phi(f_{ik})$ are linearly independent, a nontrivial linear relation must involve the $g_i$. That is, there is some nontrivial linear combination of the $g_i$ which is equal to a linear combination of the $\phi(f_{ik})$ (in some neighborhood of $y_k$); say $\sum a_{ik}g_i=\sum b_{ik}\phi(f_{ik})$ where some $a_{ik}$ is nonzero at $y_k$.
Now we just glue all these relations together using bump functions. Choose bump functions $\psi_k$ supported in small disjoint neighborhoods of $y_k$ and nonzero scalars $c_k$ which go to $0$ fast enough so that the sums $a_i=\sum c_k^2\psi_k^2a_{ik}$, $b_i=\sum c_k\psi_k b_{ik}$, and $f_i=\sum c_k\psi_k f_{ik}$ are all smooth. We then have the relation $$\sum a_ig_i=\sum b_i\phi(f_{i})$$ on an entire neigbhborhood of $x$, where the $a_i$ are not all $0$ in any neighborhood of $x$. This means that the $g_i$ are not actually linearly independent in $K_x$ (since there is a linear combination of them which has nontrivial coefficients in any neighborhood of $x$ and is equal to something in the image of $\phi$). This is a contradiction.
Thus, assuming $K_x$ is free for all $x$, the rank of the fibers of $K$ is not just upper semicontinuous but continuous (i.e., locally constant). In other words, the matrix $(\phi_{ij})$ has locally constant rank, which means as usual that the kernel and cokernel sheaves are locally free (on open sets, not just on stalks).