We investigate the generalized second law (GSL) of thermodynamics in the framework of f(R)-gravity. We consider a FRW universe filled only with ordinary matter enclosed by the dynamical apparent horizon with the Hawking temperature. For a viable modified gravity model as f(R) = R − /R + R2, we examine the validity of the GSL during the early inflation and late acceleration eras. Our results show that for the selected f(R)-gravity model minimally coupled with matter, the GSL in the early inflation epoch is satisfied only for the special range of the equation of state parameter of the matter. But in the late acceleration regime, the GSL is always respected.