Re: 2.4.33pre1 kernel/sysctl.c missing spin_unlock()

From: Willy TARREAU
Date: Thu Jan 05 2006 - 17:06:15 EST


On Thu, Jan 05, 2006 at 04:26:47PM +0100, jürgen baumann wrote:
> possibly fixed yet, but maybe not:
>
> in above patch there was a spinlock(&sysctl_lock) added in
> function do_register_sysctl_table(), but no corresponding
> spin_unlock() before return.
>
> after starting the new kernel (unfortunately with further
> patches), it hangs on trying to start the kswapd-thread.
>
> after inserting the spin_unlock() all run fine.

Can you be more specific ? First, there's no function named
like this in 2.4.33-pre1. The most approaching change I can
find lies in kernel/sysctl.c:register_sysctl_table() and this
one uses valid locking :

struct ctl_table_header *register_sysctl_table(ctl_table * table,
int insert_at_head)
{
struct ctl_table_header *tmp;
tmp = kmalloc(sizeof(struct ctl_table_header), GFP_KERNEL);
if (!tmp)
return NULL;
tmp->ctl_table = table;
INIT_LIST_HEAD(&tmp->ctl_entry);
tmp->used = 0;
tmp->unregistering = NULL;
===> spin_lock(&sysctl_lock);
if (insert_at_head)
list_add(&tmp->ctl_entry, &root_table_header.ctl_entry);
else
list_add_tail(&tmp->ctl_entry, &root_table_header.ctl_entry);
===> spin_unlock(&sysctl_lock);
#ifdef CONFIG_PROC_FS
register_proc_table(table, proc_sys_root, tmp);
#endif
return tmp;
}

So possibly you found one real bug, but please tell us where you
had to patch !

Thanks in advance,
Willy

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