A search for narrow resonances at high mass in the dimuon and dielectron channels has been performed by the CMS experiment at the CERN LHC, using pp collision data recorded at root s = 7 TeV. The event samples correspond to integrated luminosities of 40 pb(-1) in the dimuon channel and 35 pb(-1) in the dielectron channel. Heavy dilepton resonances are predicted in theoretical models with extra gauge bosons (Z') or as Kaluza-Klein graviton excitations (G(KK)) in the Randall-Sundrum model. Upper limits on the inclusive cross section of Z'(GKK) -> l + l(-) relative to Z -> l + l(-) are presented. These limits exclude at 95% confidence level a Z' with standard-model-like couplings below 1140 GeV, the superstring-inspired Z'(psi) below 887 GeV, and, for values of the coupling parameter k/(M) over bar (Pl) of 0.05 (0.1), Kaluza-Klein gravitons below 855 (1079) GeV.