Hafetz Haim Halachot
Halacha 99 / 215

Hilchos Lashon Hara chapter 6, section 12

What if he already heard lashon hara and believed it in his heart, whether it was about something between a person and other people or between a person and Hashem? The way to fix it: he should work hard to take the story out of his heart and not believe it. He should commit for the future not to accept lashon hara about any Jew again. And he should confess this sin. This fixes the commandments he broke by accepting lashon hara.

This is true only as long as he did not tell the story to others. If he did, he must ask forgiveness from the person the bad things were said about.