Because stack smashing is the most common attack against programs with buffer overflow bugs, many people believe that there's a simple cure against buffer overflow exploits, which is making the stack non-executable (i.e. telling the CPU via page protection flags that it's not allowed to execute instructions from the stack). Indeed, this does stop attacks like the one discussed above: when the CPU executes the ret instruction, the fake return address is supposed to be loaded into the program counter. However, the CPU detects that the address pointed to is in an area of memory that's marked non-executable, and hence refuses to load it into the program counter. Instead, a signal is generated, and the program is aborted.
There are various drawbacks to this.
TODO: non-exec stack on Linux
The second problem is that while non-executable stacks do protect you from the garden variety of buffer overflow exploits, executing code on the stack is rarely the only way of exploiting a buffer overflow. Some variations are listed below.