Re: [PATCH v2] mctp: fix use after free
From: Jeremy Kerr
Date: Mon Feb 14 2022 - 21:26:31 EST
Hi Tom,
> Clang static analysis reports this problem
> route.c:425:4: warning: Use of memory after it is freed
> trace_mctp_key_acquire(key);
> ^~~~~~~~~~~~~~~~~~~~~~~~~~~
> When mctp_key_add() fails, key is freed but then is later
> used in trace_mctp_key_acquire(). Add an else statement
> to use the key only when mctp_key_add() is successful.
>
> Fixes: 4f9e1ba6de45 ("mctp: Add tracepoints for tag/key handling")
> Signed-off-by: Tom Rix <trix@xxxxxxxxxx>
> ---
> v2: change the Fixes: line
Super, thanks!
Acked-off-by: Jeremy Kerr <jk@xxxxxxxxxxxxxxxxxxxx>
Cheers,
Jeremy