I typically hear two main justifications offered for China's support of North Korea: collapse of the DPRK would result in one or both of
- A refugee crisis as displaced North Koreans seek asylum in China
- One way or another, the establishment of a government friendly to the US on China's borders
For example, this article, cited in this Po answer.
I have a hard time following the logic behind the second reason. The only issue I can see in sharing a border with a US-friendly power is vulnerability in the event of a ground invasion of Chinese territory. The only circumstance I can conceive of that would involve a major act of aggression on China's part against the territory of a neighbor. Even then, it seems unlikely.
Is there some other reason why a "buffer state" is important?