Skip to contentSkip to conversation

2.4.33pre1 kernel/sysctl.c missing spin_unlock()

DISCUSSION jürgen baumann 2 participants 2 messages Jan 5, 2006

lore
Share & tools
lore
#0 lore raw

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.

#1 lore raw
Quoted 10 lines · jürgen baumann

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