Showing error 1042

User: Jiri Slaby
Error type: Leaving function in locked state
Error type description: Some lock is not unlocked on all paths of a function, so it is leaked
File location: net/netlink/af_netlink.c
Line in file: 194
Project: Linux Kernel
Project version: 2.6.28
Tools: Undetermined 1
Entered: 2012-03-04 17:07:06 UTC


Source:

 164        WARN_ON(nlk_sk(sk)->groups);
 165}
 166
 167/* This lock without WQ_FLAG_EXCLUSIVE is good on UP and it is _very_ bad on
 168 * SMP. Look, when several writers sleep and reader wakes them up, all but one
 169 * immediately hit write lock and grab all the cpus. Exclusive sleep solves
 170 * this, _but_ remember, it adds useless work on UP machines.
 171 */
 172
 173static void netlink_table_grab(void)
 174        __acquires(nl_table_lock)
 175{
 176        write_lock_irq(&nl_table_lock);
 177
 178        if (atomic_read(&nl_table_users)) {
 179                DECLARE_WAITQUEUE(wait, current);
 180
 181                add_wait_queue_exclusive(&nl_table_wait, &wait);
 182                for (;;) {
 183                        set_current_state(TASK_UNINTERRUPTIBLE);
 184                        if (atomic_read(&nl_table_users) == 0)
 185                                break;
 186                        write_unlock_irq(&nl_table_lock);
 187                        schedule();
 188                        write_lock_irq(&nl_table_lock);
 189                }
 190
 191                __set_current_state(TASK_RUNNING);
 192                remove_wait_queue(&nl_table_wait, &wait);
 193        }
 194}
 195
 196static void netlink_table_ungrab(void)
 197        __releases(nl_table_lock)
 198{
 199        write_unlock_irq(&nl_table_lock);
 200        wake_up(&nl_table_wait);
 201}
 202
 203static inline void
 204netlink_lock_table(void)
Show full sources