Re: closefd: closes a file of any process

©[@ÄØÿ¿8þÿ¿David Woodhouse (uaca@alumni.uv.es)
Tue, 27 Jun 2000 11:45:26 +0200


> Obviously you must lock files_lock, but all necessary spinlocks exist:

At least in a 2.2.x there is no files_lock, it seems it's protected with
kernel_lock()'s spinlock

Anyway... in the following example, I think thre could be a problem
please tell me if I'm right or not

>
> read_lock(&tasklist_lock);
> tsk = find_task_by_pid();
> get_task_struct(tsk);
> read_unlock(&tasklist_lock); --> here you unlock the task
> task_lock(&tsk); --> here you lock again it (for resource de/allocation

Is is posible that tsk doesn't longer exist when task_lock() is called?

> files = tsk->files;
> atomic_inc(&files->count);
> task_unlock(&tsk);
> free_task_struct(tsk);
> __do_close(files, fd, release); /* do_close, but on files instead of
> * current->files */
> put_files_struct(files);
>

Ulisses

Debian/GNU Linux: a dream come true
-----------------------------------------------------------------------------
"Computers are useless. They can only give answers." Pablo Picasso

---> Visita http://www.valux.org/ para saber acerca de la <---
---> Asociación Valenciana de Usuarios de Linux <---

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/