The Messenger of Allah ﷺ said, "No fatigue, illness, anxiety, sorrow, harm, or distress befalls a believer, not even a thorn that pricks him, except that Allah expiates some of his sins by it."
حدثنا عبد الرحمن حدثنا زهير يعني ابن محمد عن محمد بن عمرو بن حلحلة عن عطاء بن يسار
أن رسول الله ﷺ قال ما يصيب المؤمن من وصب ولا نصب ولا هم ولا حزن ولا أذى ولا غم حتى الشوكة يشاكها إلا كفر الله من خطاياه
Its isnad is sahih. Bukhari narrated it, 10:91, through the route of Zuhayr bin Muhammad, with this isnad. Muslim narrated it, 2:282, through the route of Walid bin Kathir, from Muhammad bin Amr bin Ata, from Ata bin Yasar. This is how it is established in the copies of Sahih Muslim that I have, both manuscript and printed. However, Ibn Hajar in Fath al-Bari mentioned that Walid bin Kathir followed Zuhayr bin Muhammad in this hadith from his teacher Muhammad bin Amr bin Halhala.So I do not know whether the error occurred in adding "Ibn Ata" instead of "Ibn Halhala" in the copies of Sahih Muslim, or whether Ibn Hajar was mistaken. Either way, the isnad is sahih in both cases.See 7380, 7846.