The Holy Ghost- always
The Pope- under those conditions defined by the Vatican Council in Pastor Aeternus can teach and define an article of Faith or Morals
infallibly define an article of Faith or Morals. (extraordinarily) And when he teaches from the deposit of Faith (ordinarily)
The Magisterium- when teaching in communion with the Holy Father on Catholic Morals or Dogma, does so infallibly, When in a validly promulgated dogmatic council, in union with the Pope defines dogma, or a pastoral council teaches, we are responsible not simply to heed what it proclaims, but to do so in the manner wich the Church interprets those teachings. We are not free to simply choose those items we wish to follow in our own isolated fortress, and ignore the rest.
Both the Ordinary Magisterium which is where the Magisterium transmits teaching. The infallibility of the Ordinary Magisterium ensures a faithful and orthodox transmission of that teaching. As well as Extraordinary Magisterium which is to judge the authetic teachings from false teachings. The infallibility of the Extraordinary Magisterium ensures a faithful and orthodox judgment of teaching.