is it grammatically correct to use had had?
It is correct, though it too might seem a bit awkward. To understand “had had,” we need to take a look at the present perfect and past perfect tenses. Take this sentence: “I have had too many chocolates today.” That sentence is in the present perfect tense.