net/tcp: Do cleanup on tcp_md5_key_copy() failure
authorDmitry Safonov <dima@arista.com>
Wed, 23 Nov 2022 17:38:58 +0000 (17:38 +0000)
committerJakub Kicinski <kuba@kernel.org>
Thu, 1 Dec 2022 23:53:05 +0000 (15:53 -0800)
commitb389d1affc2cc2dc8686cdab303a30b2ad3a81d4
treed41aacb33a99106cf3d2578d92b8e2c68ea88bca
parent459837b522f7dff3b6681f534d8fff4eca19b7d1
net/tcp: Do cleanup on tcp_md5_key_copy() failure

If the kernel was short on (atomic) memory and failed to allocate it -
don't proceed to creation of request socket. Otherwise the socket would
be unsigned and userspace likely doesn't expect that the TCP is not
MD5-signed anymore.

Signed-off-by: Dmitry Safonov <dima@arista.com>
Acked-by: Jakub Kicinski <kuba@kernel.org>
Reviewed-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
net/ipv4/tcp_ipv4.c
net/ipv6/tcp_ipv6.c