Controlling vortex shedding using spanwise varying passive or active actuation (namely three-dimensional control) has recently been reported as a very efficient method for regulating two-dimensional bluff-body wakes. However, the mechanism why and how the designed controller regulates vortex shedding has not been clearly understood. To understand this mechanism, we perform a linear stability analysis of two-dimensional wakes, of which the base flow is modified with the given spanwise waviness. Absolute and convective instabilities of the spanwise wavy base flows are investigated using Floquet theory. Two types of the base-flow modification are considered: varicose and sinuous modifications. Both of the base-flow modifications attenuate absolute instability of twodimensional wakes. In particular, the varicose modification is found much more effective in the attenuation than the sinuous one, and its spanwise lengths resulting in the maximum attenuation show good agreement with those in three-dimensional controls. The physical mechanism of the stabilization is found to be associated with formation of streamwise vortices from tilting of two-dimensional Kármán vortices and the subsequent tilting of these streamwise vortices by the spanwise shear in the base flow. Finally, the sensitivity of absolute instability to spanwise wavy base-flow modification is investigated. It is shown that absolute instability of two-dimensional wakes is much less sensitive to spanwise wavy base-flow modification than to two-dimensional modification. This suggests that the high efficiency observed in several three-dimensional controls is not due to sensitive response of wake instability to the spanwise waviness in base flow.