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/dccp/ccid.c |
Line in file: | 33 |
Project: | Linux Kernel |
Project version: | 2.6.28 |
Tools: |
Undetermined 1
|
Entered: | 2012-03-04 17:07:06 UTC |
3 * 4 * An implementation of the DCCP protocol 5 * Arnaldo Carvalho de Melo <acme@conectiva.com.br> 6 * 7 * CCID infrastructure 8 * 9 * This program is free software; you can redistribute it and/or modify it 10 * under the terms of the GNU General Public License version 2 as 11 * published by the Free Software Foundation. 12 */ 13 14#include "ccid.h" 15 16static struct ccid_operations *ccids[CCID_MAX]; 17#if defined(CONFIG_SMP) || defined(CONFIG_PREEMPT) 18static atomic_t ccids_lockct = ATOMIC_INIT(0); 19static DEFINE_SPINLOCK(ccids_lock); 20 21/* 22 * The strategy is: modifications ccids vector are short, do not sleep and 23 * veeery rare, but read access should be free of any exclusive locks. 24 */ 25static void ccids_write_lock(void) 26{ 27 spin_lock(&ccids_lock); 28 while (atomic_read(&ccids_lockct) != 0) { 29 spin_unlock(&ccids_lock); 30 yield(); 31 spin_lock(&ccids_lock); 32 } 33} 34 35static inline void ccids_write_unlock(void) 36{ 37 spin_unlock(&ccids_lock); 38} 39 40static inline void ccids_read_lock(void) 41{ 42 atomic_inc(&ccids_lockct); 43 smp_mb__after_atomic_inc();