apparmor: no need to delay vfree()
vfree() can be called from interrupt contexts now Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Acked-by: John Johansen <john.johansen@canonical.com> Signed-off-by: James Morris <james.l.morris@oracle.com>
This commit is contained in:
		
					parent
					
						
							
								bd71164abc
							
						
					
				
			
			
				commit
				
					
						b5b3ee6c9c
					
				
			
		
					 1 changed files with 3 additions and 21 deletions
				
			
		|  | @ -110,19 +110,6 @@ void *__aa_kvmalloc(size_t size, gfp_t flags) | ||||||
| 	return buffer; | 	return buffer; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| /**
 |  | ||||||
|  * do_vfree - workqueue routine for freeing vmalloced memory |  | ||||||
|  * @work: data to be freed |  | ||||||
|  * |  | ||||||
|  * The work_struct is overlaid to the data being freed, as at the point |  | ||||||
|  * the work is scheduled the data is no longer valid, be its freeing |  | ||||||
|  * needs to be delayed until safe. |  | ||||||
|  */ |  | ||||||
| static void do_vfree(struct work_struct *work) |  | ||||||
| { |  | ||||||
| 	vfree(work); |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| /**
 | /**
 | ||||||
|  * kvfree - free an allocation do by kvmalloc |  * kvfree - free an allocation do by kvmalloc | ||||||
|  * @buffer: buffer to free (MAYBE_NULL) |  * @buffer: buffer to free (MAYBE_NULL) | ||||||
|  | @ -131,13 +118,8 @@ static void do_vfree(struct work_struct *work) | ||||||
|  */ |  */ | ||||||
| void kvfree(void *buffer) | void kvfree(void *buffer) | ||||||
| { | { | ||||||
| 	if (is_vmalloc_addr(buffer)) { | 	if (is_vmalloc_addr(buffer)) | ||||||
| 		/* Data is no longer valid so just use the allocated space
 | 		vfree(buffer); | ||||||
| 		 * as the work_struct | 	else | ||||||
| 		 */ |  | ||||||
| 		struct work_struct *work = (struct work_struct *) buffer; |  | ||||||
| 		INIT_WORK(work, do_vfree); |  | ||||||
| 		schedule_work(work); |  | ||||||
| 	} else |  | ||||||
| 		kfree(buffer); | 		kfree(buffer); | ||||||
| } | } | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Al Viro
				Al Viro