If the pattern rejects near the end, there is an opportunity to slide it back many positions. Note that we never move backwards through the text to compare a character again - we slide the pattern forward accordingly. The linearity of KMP follows from an amortized analysis. Each time we move forward in the text we add c steps to our account, while each mismatch costs us one step. Thus if many consecutive mismatches requires the pattern to shift repeatedly, it is only because we have enough previous forward moves to compensate.
Correctness is harder to verify in the details than time complexity.
However, such improvements have little effect in practice and are tricky to program correctly. If the last character in the window does not occur anywhere in the pattern, we can shift the pattern m positions after one comparison. The algorithm precomputes a table of size describing how far to shift for a mismatch on each letter of the alphabet, i.e. depending upon the position of the rightmost occurrence of that letter in the pattern. Further, since we know that the suffix of the pattern matched up to the point of mismatch, we can precompute a table recording the next place where the suffix occurs in the pattern. We can use the bigger of the two shifts, since no intermediate position can define a legal match.