Slicing criterion for flatness in the source (Vakil 24.6.F) Exercise 24.6.F in Ravi Vakil's FOAG states:

Suppose $A$ is a $B$-algebra, $A$ and $B$ are Noetherian, $M$ is a finitely generated $A$-module, and $f \in A$ has the property that for all maximal ideals $n \subset B$, multiplication by $f$ is injective on $M/nM$. Show that if $M$ is $B$-flat, then $M/fM$ is also $B$-flat.

The hint states: Use the local criterion for flatness, Theorem 24.6.2. Notice that
$$0 \to M
\xrightarrow{\cdot f} M \to M/fM \to0$$
is a flat resolution of $M/fM$.
I got stuck on this for quite a bit. I can solve the exercise by saying that the above sequence is the beginning of a flat resolution, with a possibly non-trivial kernel on the left. Then after tensoring with $B/n$ I show that $\text{Tor}_1^B(M/fM, B/n)=0$ which gives me flatness. However, I am wondering if this is a (slightly) erroneous hint or we can actually guarantee that multiplication by $f$ is injective on $M$?
 A: I don't think it matters, because this exercise as stated is simply false. Here is a counter-example.
Let $k$ be a field, $B=k[x, y]_{(x, y) }$, the local ring of the plane at the origin. It has a unique maximal ideal $\mathfrak{n} =(x, y)$.
Let $A=B_x$. This is a localization, so $A$ is a flat $B$-module. Set $M=A$, and $f=y\in A$. Notice that
$$M/\mathfrak{n}M=A/(x, y)=0$$
where the last equality follows because $x$ is actually invertible in $A$. Thus in particular multiplication by $f$ induces an injection on $M/\mathfrak{n}M$.
Finally, I'll show that $M/fM=A/(y)$ isn't flat over $B$. This is equivalent to showing that
$$\text{Spec}\ A/(y)\to \text{Spec}\ B$$
is not a flat morphism. To show this, notice that
$$A/(y)\cong k(x)$$
as $B$-algebras (where $y=0$ in the right ring). Thus we need to show that
$$\text{Spec}\ k(x) \to \text{Spec}\ B$$
is not flat, where the map is induced by localizing at $x$ and dividing by $(y)$.
The image of the single point in $\text{Spec}\ k(x)$ maps under this morphism to the prime ideal $(y)\subset B$. This is not the generic point, so cannot be an associated point (as $B$ is an integral domain). But under flat maps, associated points must map to associated points (Exercise 24.2.J). This completes the proof. $\blacksquare$
Edit: The Exercise is correct if $B\to A$ is assumed to be a local map of local rings, in which case the solution you outlined works. In this case, it is true that multiplication by $f$ induces an injection on $M$. This is a special case of Stacks (tag 00ME). Here is the outline of the proof:
First, we prove that $\cdot f: M/\mathfrak{n}^kM\to M/\mathfrak{n}^kM$ is injective for all $k>0$, by induction on $k$ (where the base case is given). The short exact sequence
$$0\to \mathfrak{n}^k/\mathfrak{n}^{k+1}\to B/\mathfrak{n}^{k+1}\to B/\mathfrak{n}^k\to 0$$
when tensored with $M$ yields a short exact sequence (by flatness)
$$0\to M\otimes_B\mathfrak{n}^k/\mathfrak{n}^{k+1} \to M/\mathfrak{n}^{k+1}M\to M/\mathfrak{n}^kM\to 0$$
Multiplication by $f$ is a map from this sequence to itself, which is injective on $M/\mathfrak{n}^kM$ by the induction hypothesis, and injective on $M\otimes_B \mathfrak{n}^k/\mathfrak{n}^{k+1}$ because
$$M\otimes_B \mathfrak{n}^k/\mathfrak{n}^{k+1}=M/\mathfrak{n}M\otimes_{B/\mathfrak{n}} \mathfrak{n}^k/\mathfrak{n}^{k+1}$$
and the map acts on this product by $(\cdot f)\otimes \text{id}$. Thus the map is also injective on the middle term $M/\mathfrak{n}^{k+1}M$, which completes the induction step.
Note that by Krull's intersection theorem (Exercise 12.9.A in Vakil), applied to the ring $A$ and the ideal $\mathfrak{n}A$, we know that
$$\bigcap_{i \geq 1}\mathfrak{n}^i M=0$$
Thus if a map $M\to M$ is injective when dividing by $\mathfrak{n}^k$ for each $k\geq 1$, then it is injective. This completes the proof.$\blacksquare$
