Prevent Null Pointer Dereference in kernel space code
before passing a kernel pointer to user space syscall / function related make sure use:
set_fs(KERNEL_DS)
the old_fs will be used to save the old value
old_fs=get_fs();
set_fs(KERNEL_DS);
/**some code to pass a kernel space pointer to user space syscall , etc**/
then we gotta bring it back:
set_fs(old_fs);
Home »Unlabelled » Prevent Null Pointer Dereference in kernel space code