(With examples from Dorothy Sayers' Peter Wimsey mysteries.)
Short answer: Yes.
I just wanted to get that out of the way, because I'm about to get a little out of control with this topic and wanted to make sure you didn't leave without getting your answer taken care of first.
We're working with verb tenses here, specifically the past perfect. If you'd like a refresher, momebie and supercheesegirl did an awesome Grammar 101 on verbs here that will tell you everything you need to know for this discussion. But briefly, past perfect tense is used when an action takes place before another action in the past. So if you’re writing in past tense and discussing what happened to your character the day before, you would use past perfect. To create the past perfect tense, you use "had" plus the past participle form of the verb. Here's an example using the verb "to pour."
Past tense: Bunter poured Lord Peter and Chief Inspector Parker each a measure of brandy.
Past perfect tense: He had poured himself a similar quantity earlier, at Lord Peter’s insistence. It had, indeed, been a trying day for them all.
Where it gets tricky is when the verb in question isn’t “to pour” or any of the other thousands of verbs out there, but “to have.” Because the past participle form of “to have” is — you guessed it — “had.” So you add “had” to, well, “had” and get the regrettable but absolutely correct “had had.”
Past tense: “I did know him,” said Wimsey. “A fellow collector of incunabula. He had a Livius ‘Historiae Romanae’ I never could convince him to part with.”
Past perfect tense: “Hang it, Parker, that will never do. Unless our murderer had had the weapon on his person the whole time, he could never have procured it so quickly.”
While this construction is grammatically correct, it is awkward. Otherwise writinginct probably wouldn’t have asked about it. There are options. You can write around it by using the participle of a verb other than “to have” or even just using the contracted form of the first “had." Compare the following three options.
The witness said unsteadily, “Until I saw the blood, I just thought he had had too much to drink.”
“Until I saw the blood, I just thought he had drunk too much.”
“Until I saw the blood, I just thought he’d had too much to drink.”
With the contraction, you’re still using “had had,” but it doesn’t strike the reader’s eye or reading ear the same way, so there isn’t the same awkwardness for the reader.
That is not to say you should never use “had had.” Sometimes that slowing, awkward effect is exactly what you’re looking for. It can demonstrate deliberation, humor or emphasis.
“He was being absolutely beastly, so I informed him that I had had quite enough of his foolishness,” Miss Stanhope recounted frostily.
But you wouldn’t want to get carried away with it. Consider the following classic example of lexical ambiguity:
Jane while John had had had had had had had had had had had the teacher's approval.
It looks like gibberish, but if you add punctuation, it is actually syntactically correct. Here’s the scenario: There was a test in which the answer options were past tense (had) or past perfect (had had). The teacher was looking for the past perfect tense. Jane had the correct answer; John did not.
Jane, while John had had "had," had had "had had"; "had had" had had the teacher's approval.
So, yes. “Had had” is correct. Even “had had had had had had had had had had had” can be correct given a convoluted enough scenario and a little punctuation. But “had had” does sound a little weird, so much of the time you’re probably better off writing around it.