We show that if an Eisenstein component of the p-adic Hecke algebra associated to modular forms is Gorenstein, then it is necessary that the plus-part of a certain ideal class group is trivial. We also show that this condition is sufficient whenever a conjecture of Sharifi holds.