Re: [PATCH] selinux: fix bad cleanup on error in hashtab_duplicate()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, May 17, 2022 at 8:08 AM Ondrej Mosnacek <omosnace@xxxxxxxxxx> wrote:
>
> The code attempts to free the 'new' pointer using kmem_cache_free(),
> which is wrong because this function isn't responsible of freeing it.
> Instead, the function should free new->htable and clear the contents of
> *new (to prevent double-free).
>
> Fixes: c7c556f1e81b ("selinux: refactor changing booleans")
> Reported-by: Wander Lairson Costa <wander@xxxxxxxxxx>
> Signed-off-by: Ondrej Mosnacek <omosnace@xxxxxxxxxx>
> ---
>  security/selinux/ss/hashtab.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)

Good catch, merged into selinux/stable-5.18 and I'll plan on sending
this to Linus tomorrow once the tests finish running.

-- 
paul-moore.com



[Index of Archives]     [Selinux Refpolicy]     [Linux SGX]     [Fedora Users]     [Fedora Desktop]     [Yosemite Photos]     [Yosemite Camping]     [Yosemite Campsites]     [KDE Users]     [Gnome Users]

  Powered by Linux