User: | Jiri Slaby |
Error type: | Resource Leak |
Error type description: | The code omits to put the resource to the system for reuse |
File location: | arch/x86/mm/kmmio.c |
Line in file: | 190 |
Project: | Linux Kernel |
Project version: | 2.6.28 |
Tools: |
Stanse
(1.2)
|
Entered: | 2011-11-07 22:40:13 UTC |
160 161/* 162 * This is being called from do_page_fault(). 163 * 164 * We may be in an interrupt or a critical section. Also prefecthing may 165 * trigger a page fault. We may be in the middle of process switch. 166 * We cannot take any locks, because we could be executing especially 167 * within a kmmio critical section. 168 * 169 * Local interrupts are disabled, so preemption cannot happen. 170 * Do not enable interrupts, do not sleep, and watch out for other CPUs. 171 */ 172/* 173 * Interrupts are disabled on entry as trap3 is an interrupt gate 174 * and they remain disabled thorough out this function. 175 */ 176int kmmio_handler(struct pt_regs *regs, unsigned long addr) 177{ 178 struct kmmio_context *ctx; 179 struct kmmio_fault_page *faultpage; 180 int ret = 0; /* default to fault not handled */ 181 182 /* 183 * Preemption is now disabled to prevent process switch during 184 * single stepping. We can only handle one active kmmio trace 185 * per cpu, so ensure that we finish it before something else 186 * gets to run. We also hold the RCU read lock over single 187 * stepping to avoid looking up the probe and kmmio_fault_page 188 * again. 189 */ 190 preempt_disable(); 191 rcu_read_lock(); 192 193 faultpage = get_kmmio_fault_page(addr); 194 if (!faultpage) { 195 /* 196 * Either this page fault is not caused by kmmio, or 197 * another CPU just pulled the kmmio probe from under 198 * our feet. The latter case should not be possible. 199 */ 200 goto no_kmmio;