From: Pan Bian Date: Thu, 21 Jan 2021 07:34:19 +0000 (-0800) Subject: Bluetooth: drop HCI device reference before return X-Git-Tag: v4.4.259~81 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9729dcb127c890b3444d5387eaf3f3ef1058eabc;p=thirdparty%2Fkernel%2Fstable.git Bluetooth: drop HCI device reference before return [ 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 Signed-off-by: Marcel Holtmann Signed-off-by: Sasha Levin --- diff --git a/net/bluetooth/a2mp.c b/net/bluetooth/a2mp.c index 242ef2abd0911..fcd819ffda108 100644 --- a/net/bluetooth/a2mp.c +++ b/net/bluetooth/a2mp.c @@ -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; }