forked from mirrors/linux
		
	sparc: bpf_jit_comp: can call module_free() from any context
module_free()/vfree() takes care of details, we no longer need a wrapper and a work_struct. Signed-off-by: Eric Dumazet <edumazet@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
		
							parent
							
								
									57b354e66b
								
							
						
					
					
						commit
						5199dfe531
					
				
					 1 changed files with 3 additions and 17 deletions
				
			
		| 
						 | 
					@ -785,9 +785,7 @@ cond_branch:			f_offset = addrs[i + filter[i].jf];
 | 
				
			||||||
			break;
 | 
								break;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		if (proglen == oldproglen) {
 | 
							if (proglen == oldproglen) {
 | 
				
			||||||
			image = module_alloc(max_t(unsigned int,
 | 
								image = module_alloc(proglen);
 | 
				
			||||||
						   proglen,
 | 
					 | 
				
			||||||
						   sizeof(struct work_struct)));
 | 
					 | 
				
			||||||
			if (!image)
 | 
								if (!image)
 | 
				
			||||||
				goto out;
 | 
									goto out;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
| 
						 | 
					@ -806,20 +804,8 @@ cond_branch:			f_offset = addrs[i + filter[i].jf];
 | 
				
			||||||
	return;
 | 
						return;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void jit_free_defer(struct work_struct *arg)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
	module_free(NULL, arg);
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/* run from softirq, we must use a work_struct to call
 | 
					 | 
				
			||||||
 * module_free() from process context
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
void bpf_jit_free(struct sk_filter *fp)
 | 
					void bpf_jit_free(struct sk_filter *fp)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	if (fp->bpf_func != sk_run_filter) {
 | 
						if (fp->bpf_func != sk_run_filter)
 | 
				
			||||||
		struct work_struct *work = (struct work_struct *)fp->bpf_func;
 | 
							module_free(NULL, fp->bpf_func);
 | 
				
			||||||
 | 
					 | 
				
			||||||
		INIT_WORK(work, jit_free_defer);
 | 
					 | 
				
			||||||
		schedule_work(work);
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue