]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
Bluetooth: drop HCI device reference before return
authorPan Bian <bianpan2016@163.com>
Thu, 21 Jan 2021 07:34:19 +0000 (23:34 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 4 Mar 2021 08:39:34 +0000 (09:39 +0100)
[ Upstream commit 5a3ef03afe7e12982dc3b978f4c5077c907f7501 ]

Call hci_dev_put() to decrement reference count of HCI device hdev if
fails to duplicate memory.

Fixes: 0b26ab9dce74 ("Bluetooth: AMP: Handle Accept phylink command status evt")
Signed-off-by: Pan Bian <bianpan2016@163.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
net/bluetooth/a2mp.c

index 888813342cfc8d990e28b89e5137f14e120e1a95..e09ea78356c3641be1d7ed20da3bb7e8936d6949 100644 (file)
@@ -519,6 +519,7 @@ static int a2mp_createphyslink_req(struct amp_mgr *mgr, struct sk_buff *skb,
                assoc = kmemdup(req->amp_assoc, assoc_len, GFP_KERNEL);
                if (!assoc) {
                        amp_ctrl_put(ctrl);
+                       hci_dev_put(hdev);
                        return -ENOMEM;
                }