I patched the kernel in memory first, using a kernel debugger, to verify my fix worked before editing the file on disk.
(Working out how to patch such that I wouldn't crash the system if a process happens to call that API while it was in a half-modified state was also a fun problem...)
I dug out the details on the bug I patched, and it isn't the same as this one; it's a race condition with timeouts on waiting for keyed events, which I believe isn't applicable in this situation as there are no timeouts.
http://www.malsmith.net/blog/patching-closed-software/
Note: not my blog. (Edit: removed a probably unnecessary, and likely inaccurate, detail).
Patching the kernel would involve a similar (but slightly more complicated) process.