]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
chelsio/chtls: fix memory leaks caused by a race
authorVinay Kumar Yadav <vinay.yadav@chelsio.com>
Mon, 2 Nov 2020 17:36:51 +0000 (23:06 +0530)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 10 Nov 2020 11:38:56 +0000 (12:38 +0100)
commitd38c4b58aaa78f475d88ece4199472c9008ebc1c
tree3efaf856e99e8d77768c889e1be1bd6fc42c0d0c
parentc2c1c56dfb25eb3390bb1fba00757c9b455ab3b0
chelsio/chtls: fix memory leaks caused by a race

[ Upstream commit 8080b462b6aa856ae05ea010441a702599e579f2 ]

race between user context and softirq causing memleak,
consider the call sequence scenario

chtls_setkey()         //user context
chtls_peer_close()
chtls_abort_req_rss()
chtls_setkey()         //user context

work request skb queued in chtls_setkey() won't be freed
because resources are already cleaned for this connection,
fix it by not queuing work request while socket is closing.

v1->v2:
- fix W=1 warning.

v2->v3:
- separate it out from another memleak fix.

Fixes: cc35c88ae4db ("crypto : chtls - CPL handler definition")
Signed-off-by: Vinay Kumar Yadav <vinay.yadav@chelsio.com>
Link: https://lore.kernel.org/r/20201102173650.24754-1-vinay.yadav@chelsio.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/crypto/chelsio/chtls/chtls_hw.c