[PATCH] staging:brcm80211:bug fix- rmmod hang problem

Nohee Ko noheek at broadcom.com
Wed Oct 13 19:09:57 UTC 2010


Thanks for the tips.
I did not pay attention to optimization. 
I will send the patch with the fix.

Thanks
Nohee

-----Original Message-----
From: Jiri Slaby [mailto:jirislaby at gmail.com] 
Sent: Wednesday, October 13, 2010 6:21 AM
To: Nohee Ko
Cc: greg at kroah.com; devel at linuxdriverproject.org; joe at perches.com; Henry Ptasinski; Brett Rudley; Venkat Rao; grundler at google.com; jason at lakedaemon.net
Subject: Re: [PATCH] staging:brcm80211:bug fix- rmmod hang problem

On 10/12/2010 10:33 PM, nohee ko wrote:
> --- a/drivers/staging/brcm80211/include/linuxver.h
> +++ b/drivers/staging/brcm80211/include/linuxver.h
> @@ -35,14 +35,11 @@
>  #undef IP_TOS
>  #include <asm/io.h>
>  
> -#define KILL_PROC(nr, sig) \
> +#define KILL_PROC(pid, sig) \
>  	do { \
>  		struct task_struct *tsk; \
> -		struct pid *pid;    \
> -		pid = find_get_pid((pid_t)nr);    \
> -		tsk = pid_task(pid, PIDTYPE_PID);    \
> -		if (tsk) \
> -			send_sig(sig, tsk, 1); \
> +		tsk = pid_task(find_vpid(pid), PIDTYPE_PID);    \
> +		if (tsk)	\
> +		send_sig(sig, tsk, 1); \

This is broken. You have to hold rcu_read_lock() here otherwise you are
unsafe and can blow up. Actually you don't need that crap at all. You
have already task_struct, so you can easily call send_sig directly.

And instead of these weird plays with signals and abuse of semaphores,
you can use completion, can't you?

regards,
-- 
js





More information about the devel mailing list