You use "who" when you are talking about the subject, and you use "whom" when you are talking about the object. A good rule of thumb is if you can replace "who/whom" with "he", then it's the subject, and if you can replace it with "him" then it's the object.