A mesoscopic model of a diblock copolymer is used to study the stability of a lamellar structure under a uniform shear flow. We first obtain the nonlinear lamellar solutions under both steady and oscillatory shear flows. Regions of existence of these solutions are determined as a function of the parameters of the model and of the flow. Finally, we address the stability of the lamellar solution against long-wavelength perturbations.