mirror of
https://github.com/torvalds/linux.git
synced 2026-12-04 20:34:05 +00:00
The memtype seq_file iterator allocates a buffer in the ->start and ->next functions and frees it in the ->show function. The preferred handling for such resources is to free them in the subsequent ->next or ->stop function call. Since Commit1f4aace60b("fs/seq_file.c: simplify seq_file iteration code and interface") there is no guarantee that ->show will be called after ->next, so this function can now leak memory. So move the freeing of the buffer to ->next and ->stop. Link: https://lkml.kernel.org/r/161248539022.21478.13874455485854739066.stgit@noble1 Fixes:1f4aace60b("fs/seq_file.c: simplify seq_file iteration code and interface") Signed-off-by: NeilBrown <[email protected]> Cc: Xin Long <[email protected]> Cc: Alexander Viro <[email protected]> Cc: Andy Lutomirski <[email protected]> Cc: Dave Hansen <[email protected]> Cc: "David S. Miller" <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: Jonathan Corbet <[email protected]> Cc: Marcelo Ricardo Leitner <[email protected]> Cc: Neil Horman <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Vlad Yasevich <[email protected]> Cc: <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>