The Messenger of Allah ﷺ said, "When a slave obeys his Lord and his master, he receives two rewards."
حدثنا مؤمل قال حدثنا حماد قال حدثنا عمار بن أبي عمار أنه
قال رسول الله ﷺ العبد إذا أطاع ربه وسيده فله أجران
Its isnad is sahih. It occurred previously in 4673, and it is found in Bukhari 3/195 in the chapter on manumission, "When the slave does well," and in Malik 2/981 in the chapter on seeking permission.