]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
Bluetooth: msft: Fix memory leak
authorLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
Wed, 28 Feb 2024 15:56:49 +0000 (10:56 -0500)
committerSasha Levin <sashal@kernel.org>
Tue, 26 Mar 2024 22:16:54 +0000 (18:16 -0400)
[ Upstream commit a6e06258f4c31eba0fcd503e19828b5f8fe7b08b ]

Fix leaking buffer allocated to send MSFT_OP_LE_MONITOR_ADVERTISEMENT.

Fixes: 9e14606d8f38 ("Bluetooth: msft: Extended monitor tracking by address filter")
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
net/bluetooth/msft.c

index 630e3023273b251bbb203fed81814166aa10ea7f..9612c5d1b13f6d2eed675d94d81c5e9b1483afa3 100644 (file)
@@ -875,6 +875,7 @@ static int msft_add_address_filter_sync(struct hci_dev *hdev, void *data)
                remove = true;
                goto done;
        }
+
        cp->sub_opcode           = MSFT_OP_LE_MONITOR_ADVERTISEMENT;
        cp->rssi_high            = address_filter->rssi_high;
        cp->rssi_low             = address_filter->rssi_low;
@@ -887,6 +888,8 @@ static int msft_add_address_filter_sync(struct hci_dev *hdev, void *data)
 
        skb = __hci_cmd_sync(hdev, hdev->msft_opcode, size, cp,
                             HCI_CMD_TIMEOUT);
+       kfree(cp);
+
        if (IS_ERR(skb)) {
                bt_dev_err(hdev, "Failed to enable address %pMR filter",
                           &address_filter->bdaddr);