Mishkat al-Masabih 263
وَعَنْ عَبْدِ اللَّهِ بْنِ مَسْعُودٍ قَالَ: لَوْ أَنَّ أَهْلَ الْعِلْمِ صَانُوا الْعِلْمَ وَوَضَعُوهُ عِنْدَ أَهْلِهِ لَسَادُوا بِهِ أَهْلَ زَمَانِهِمْ وَلَكِنَّهُمْ بَذَلُوهُ لِأَهْلِ الدُّنْيَا لِيَنَالُوا بِهِ مِنْ دُنْيَاهُمْ فَهَانُوا عَلَيْهِمْ سَمِعْتُ نَبِيَّكُمْ صَلَّى اللَّهُ عَلَيْهِ وَسَلَّمَ يَقُولُ: «مَنْ جَعَلَ الْهُمُومَ هَمًّا وَاحِدًا هَمَّ آخِرَتِهِ كَفَاهُ اللَّهُ هَمَّ دُنْيَاهُ وَمَنْ تَشَعَّبَتْ بِهِ الْهُمُومُ فِي أَحْوَالِ الدُّنْيَا لَمْ يُبَالِ اللَّهُ فِي أَيِّ أَوْدِيَتِهَا هَلَكَ» . رَوَاهُ ابْنُ مَاجَه
From ʿAbdullah ibn Masʿud, who said: If the people of knowledge had guarded knowledge and placed it with those worthy of it, they would have become leaders of the people of their time through it. But they gave it freely to the people of the world in order to gain some of their worldly goods by it, so they became worthless in their eyes. I heard your Prophet ﷺ say: "Whoever makes his concerns a single concern, the concern of his Hereafter, Allah will suffice him the concern of his worldly life. And whoever has his concerns scattered among the affairs of the world, Allah will not care in which of its valleys he perishes." Reported by Ibn Majah.