]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
ipv6: sr: fix memleak in seg6_hmac_init_algo
authorHangbin Liu <liuhangbin@gmail.com>
Fri, 17 May 2024 00:54:35 +0000 (08:54 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 16 Jun 2024 11:39:47 +0000 (13:39 +0200)
commit61d31ac85b4572d11f8071855c0ccb4f32d76c0c
tree9a0add097c9f8f4218ba4115fc22533be3316349
parent518a994aa0b87d96f1bc6678a7035df5d1fcd7a1
ipv6: sr: fix memleak in seg6_hmac_init_algo

[ Upstream commit efb9f4f19f8e37fde43dfecebc80292d179f56c6 ]

seg6_hmac_init_algo returns without cleaning up the previous allocations
if one fails, so it's going to leak all that memory and the crypto tfms.

Update seg6_hmac_exit to only free the memory when allocated, so we can
reuse the code directly.

Fixes: bf355b8d2c30 ("ipv6: sr: add core files for SR HMAC support")
Reported-by: Sabrina Dubroca <sd@queasysnail.net>
Closes: https://lore.kernel.org/netdev/Zj3bh-gE7eT6V6aH@hog/
Signed-off-by: Hangbin Liu <liuhangbin@gmail.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Reviewed-by: Sabrina Dubroca <sd@queasysnail.net>
Link: https://lore.kernel.org/r/20240517005435.2600277-1-liuhangbin@gmail.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
net/ipv6/seg6_hmac.c