Hadithcore
Mishkat al-Masabih, 3664

Ibn ‘Umar reported God’s Messenger as saying, “Hearing and obeying are the duty of a Muslim man both regarding what he likes and what he dislikes, as long as he is not commanded to perform an act of disobedience to God, in which case he must neither hear nor obey.” (Bukhari and Muslim.)

وَعَنِ ابْنِ عُمَرَ رَضِيَ اللَّهُ عَنْهُمَا قَالَ: قَالَ رَسُولُ اللَّهِ صَلَّى اللَّهُ عَلَيْهِ وَسَلَّمَ: «السَّمعُ والطاعةُ على المرءِ المسلمِ فِيمَا أحب وأكره مَا لَمْ يُؤْمَرْ بِمَعْصِيَةٍ فَإِذَا أُمِرَ بِمَعْصِيَةٍ فَلَا سَمْعَ وَلَا طَاعَةَ»

References1 variant
In-Book Reference
Book 18, Hadith 4