kernel - fix crash in smb mount
authorNicolas Thery <nthery@gmail.com>
Sat, 10 Jul 2010 08:43:31 +0000 (10:43 +0200)
committerNicolas Thery <nthery@gmail.com>
Sat, 10 Jul 2010 08:43:31 +0000 (10:43 +0200)
commitbe36369df85afceebd0c8caca4b22f6e7a147f4f
tree17e7959c15847a2360fcec3e02a8f9b92a0abd6f
parent8d6d9ec2d44c984fe6a1f7d294e069b658572952
kernel - fix crash in smb mount

The samba kernel-side daemon smbiod is created with
kthread_create_compat().

Kernel threads created with kthread_create_compat() have no td_ucred, as
other kernel threads, but have td_proc != NULL because this function
under the hood forks the process 0.

prison_replace_wildcard() was assuming that if td_proc != NULL it is
dealing with a user thread that has a valid td_ucred thus causing a NULL
ptr dereference when operating on kthread_create_compat()-threads.

Reported-and-fixed-by: Tero Jaasko
Dragonfly-bug: <http://bugs.dragonflybsd.org/issue1790>
sys/kern/kern_jail.c