mirror of
				https://github.com/torvalds/linux.git
				synced 2025-11-04 02:30:34 +02:00 
			
		
		
		
	kasan: call kasan_malloc() from __kmalloc_*track_caller()
We were failing to call kasan_malloc() from __kmalloc_*track_caller() which was causing us to sometimes fail to produce KASAN error reports for allocations made using e.g. devm_kcalloc(), as the KASAN poison was not being initialized. Fix it. Signed-off-by: Peter Collingbourne <pcc@google.com> Cc: <stable@vger.kernel.org> # 5.15 Signed-off-by: Vlastimil Babka <vbabka@suse.cz>
This commit is contained in:
		
							parent
							
								
									7e9c323c52
								
							
						
					
					
						commit
						5373b8a09d
					
				
					 1 changed files with 4 additions and 0 deletions
				
			
		| 
						 | 
					@ -4926,6 +4926,8 @@ void *__kmalloc_track_caller(size_t size, gfp_t gfpflags, unsigned long caller)
 | 
				
			||||||
	/* Honor the call site pointer we received. */
 | 
						/* Honor the call site pointer we received. */
 | 
				
			||||||
	trace_kmalloc(caller, ret, s, size, s->size, gfpflags);
 | 
						trace_kmalloc(caller, ret, s, size, s->size, gfpflags);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						ret = kasan_kmalloc(s, ret, size, gfpflags);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return ret;
 | 
						return ret;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
EXPORT_SYMBOL(__kmalloc_track_caller);
 | 
					EXPORT_SYMBOL(__kmalloc_track_caller);
 | 
				
			||||||
| 
						 | 
					@ -4957,6 +4959,8 @@ void *__kmalloc_node_track_caller(size_t size, gfp_t gfpflags,
 | 
				
			||||||
	/* Honor the call site pointer we received. */
 | 
						/* Honor the call site pointer we received. */
 | 
				
			||||||
	trace_kmalloc_node(caller, ret, s, size, s->size, gfpflags, node);
 | 
						trace_kmalloc_node(caller, ret, s, size, s->size, gfpflags, node);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						ret = kasan_kmalloc(s, ret, size, gfpflags);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return ret;
 | 
						return ret;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
EXPORT_SYMBOL(__kmalloc_node_track_caller);
 | 
					EXPORT_SYMBOL(__kmalloc_node_track_caller);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue