[Bridge] [PATCH] netfilter: ebtables: compat: fix a memory leak bug

Florian Westphal fw at strlen.de
Sun Jul 21 00:26:23 UTC 2019


Wenwen Wang <wang6495 at umn.edu> wrote:
> From: Wenwen Wang <wenwen at cs.uga.edu>
> 
> In compat_do_replace(), a temporary buffer is allocated through vmalloc()
> to hold entries copied from the user space. The buffer address is firstly
> saved to 'newinfo->entries', and later on assigned to 'entries_tmp'. Then
> the entries in this temporary buffer is copied to the internal kernel
> structure through compat_copy_entries(). If this copy process fails,
> compat_do_replace() should be terminated. However, the allocated temporary
> buffer is not freed on this path, leading to a memory leak.
> 
> To fix the bug, free the buffer before returning from compat_do_replace().
> 
> Signed-off-by: Wenwen Wang <wenwen at cs.uga.edu>

Reviewed-by: Florian Westphal <fw at strlen.de>


More information about the Bridge mailing list