]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
nfc: nfcmrvl: Fix memory leak in nfcmrvl_play_deferred
authorXiaohui Zhang <xiaohuizhang@ruc.edu.cn>
Tue, 7 Jun 2022 08:32:30 +0000 (16:32 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 25 Jun 2022 09:45:17 +0000 (11:45 +0200)
commit1eb0afecfb9cd0f38424b82bd9aaa542310934ee
treed84637388eafc9004c87d59018df26bc15ab7083
parent78b34fd0d7546bf9daae995855609363be770343
nfc: nfcmrvl: Fix memory leak in nfcmrvl_play_deferred

[ Upstream commit 8a4d480702b71184fabcf379b80bf7539716752e ]

Similar to the handling of play_deferred in commit 19cfe912c37b
("Bluetooth: btusb: Fix memory leak in play_deferred"), we thought
a patch might be needed here as well.

Currently usb_submit_urb is called directly to submit deferred tx
urbs after unanchor them.

So the usb_giveback_urb_bh would failed to unref it in usb_unanchor_urb
and cause memory leak.

Put those urbs in tx_anchor to avoid the leak, and also fix the error
handling.

Signed-off-by: Xiaohui Zhang <xiaohuizhang@ruc.edu.cn>
Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://lore.kernel.org/r/20220607083230.6182-1-xiaohuizhang@ruc.edu.cn
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/nfc/nfcmrvl/usb.c