Message ID | 20201008083831.521769-1-eric.dumazet@gmail.com (mailing list archive) |
---|---|
State | Accepted |
Commit | d42ee76ecb6c49d499fc5eb32ca34468d95dbc3e |
Headers | show |
Series | [net] sctp: fix sctp_auth_init_hmacs() error path | expand |
On Thu, Oct 08, 2020 at 01:38:31AM -0700, Eric Dumazet wrote: > From: Eric Dumazet <edumazet@google.com> > > After freeing ep->auth_hmacs we have to clear the pointer > or risk use-after-free as reported by syzbot: > Acked-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
Hello: This patch was applied to netdev/net.git (refs/heads/master): On Thu, 8 Oct 2020 01:38:31 -0700 you wrote: > From: Eric Dumazet <edumazet@google.com> > > After freeing ep->auth_hmacs we have to clear the pointer > or risk use-after-free as reported by syzbot: > > BUG: KASAN: use-after-free in sctp_auth_destroy_hmacs net/sctp/auth.c:509 [inline] > BUG: KASAN: use-after-free in sctp_auth_destroy_hmacs net/sctp/auth.c:501 [inline] > BUG: KASAN: use-after-free in sctp_auth_free+0x17e/0x1d0 net/sctp/auth.c:1070 > Read of size 8 at addr ffff8880a8ff52c0 by task syz-executor941/6874 > > [...] Here is the summary with links: - [net] sctp: fix sctp_auth_init_hmacs() error path https://git.kernel.org/netdev/net/c/d42ee76ecb6c You are awesome, thank you! -- Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html
diff --git a/net/sctp/auth.c b/net/sctp/auth.c index 9e289c770574f6009b1e854ee4b9b3d5f942d4d5..7e59d8a18f3e40368eb911b63ac9f514b1dcf095 100644 --- a/net/sctp/auth.c +++ b/net/sctp/auth.c @@ -494,6 +494,7 @@ int sctp_auth_init_hmacs(struct sctp_endpoint *ep, gfp_t gfp) out_err: /* Clean up any successful allocations */ sctp_auth_destroy_hmacs(ep->auth_hmacs); + ep->auth_hmacs = NULL; return -ENOMEM; }