mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* valid task structure and wake_up_process
@ 2008-04-14 18:36 Shirish Pargaonkar
  2008-04-14 19:11 ` Arjan van de Ven
  0 siblings, 1 reply; 3+ messages in thread
From: Shirish Pargaonkar @ 2008-04-14 18:36 UTC (permalink / raw)
  To: linux-kernel

How do I check whether a task is valid before calling wake_up_process() with
that task structure pointer?
I could call wake_up_process with a task structure that is corrupt or incorrect
and that could cause a system crash, so I wanted to do a sanity check of
the task structure.

I do not subscribe to this list, so please copy me you responses.

Regards,

Shirish

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: valid task structure and wake_up_process
  2008-04-14 18:36 valid task structure and wake_up_process Shirish Pargaonkar
@ 2008-04-14 19:11 ` Arjan van de Ven
  2008-04-14 20:01   ` Shirish Pargaonkar
  0 siblings, 1 reply; 3+ messages in thread
From: Arjan van de Ven @ 2008-04-14 19:11 UTC (permalink / raw)
  To: Shirish Pargaonkar; +Cc: linux-kernel

On Mon, 14 Apr 2008 13:36:42 -0500
"Shirish Pargaonkar" <shirishpargaonkar@gmail.com> wrote:

> How do I check whether a task is valid before calling
> wake_up_process() with that task structure pointer?

Hi,

how did you get the pointer you got?

That part (the guy who gave you the pointer) should have taken a reference on the task basically,
or otherwise locked against the task going away.

In giving you advice it would help tremendously if you actually posted your code...





-- 
If you want to reach me at my work email, use arjan@linux.intel.com
For development, discussion and tips for power savings, 
visit http://www.lesswatts.org

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: valid task structure and wake_up_process
  2008-04-14 19:11 ` Arjan van de Ven
@ 2008-04-14 20:01   ` Shirish Pargaonkar
  0 siblings, 0 replies; 3+ messages in thread
From: Shirish Pargaonkar @ 2008-04-14 20:01 UTC (permalink / raw)
  To: Arjan van de Ven; +Cc: linux-kernel

On 4/14/08, Arjan van de Ven <arjan@infradead.org> wrote:
> On Mon, 14 Apr 2008 13:36:42 -0500
> "Shirish Pargaonkar" <shirishpargaonkar@gmail.com> wrote:
>
> > How do I check whether a task is valid before calling
> > wake_up_process() with that task structure pointer?
>
> Hi,
>
> how did you get the pointer you got?
>
> That part (the guy who gave you the pointer) should have taken a reference on the task basically,
> or otherwise locked against the task going away.
>
> In giving you advice it would help tremendously if you actually posted your code...
>
>
>
>
>
> --
> If you want to reach me at my work email, use arjan@linux.intel.com
> For development, discussion and tips for power savings,
> visit http://www.lesswatts.org
>

Thanks.

This is cifs code fs/cifs.

In cifs_demultiplex_thread, in fs/cifs/connect.c, it calls wake_up_process in
a thread cifsd.

The task struct ptr is stored in mid as current when sending a request.  So this
could a command such as ls or some other application.
A request was sent but a reply was not received or reply was processed late
before the process went away and we have a probably freed task structure
being treated as valid in cifs_demultiplex_thread.

So I thought of checking validity of task structure before calling
wake_up_process.

Regards,

Shirish

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2008-04-14 20:01 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-04-14 18:36 valid task structure and wake_up_process Shirish Pargaonkar
2008-04-14 19:11 ` Arjan van de Ven
2008-04-14 20:01   ` Shirish Pargaonkar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®