From: Tedd Ho-Jeong An Date: Wed, 26 May 2021 17:36:22 +0000 (-0700) Subject: Bluetooth: mgmt: Fix the command returns garbage parameter value X-Git-Tag: v5.12.18~93 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4642d5a222a5ef1e9a2d1797127e1013664bc2f2;p=thirdparty%2Fkernel%2Fstable.git Bluetooth: mgmt: Fix the command returns garbage parameter value [ Upstream commit 02ce2c2c24024aade65a8d91d6a596651eaf2d0a ] When the Get Device Flags command fails, it returns the error status with the parameters filled with the garbage values. Although the parameters are not used, it is better to fill with zero than the random values. Signed-off-by: Tedd Ho-Jeong An Signed-off-by: Marcel Holtmann Signed-off-by: Sasha Levin --- diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c index 06e24b5e164de..b4f6773b1a5b6 100644 --- a/net/bluetooth/mgmt.c +++ b/net/bluetooth/mgmt.c @@ -4056,6 +4056,8 @@ static int get_device_flags(struct sock *sk, struct hci_dev *hdev, void *data, hci_dev_lock(hdev); + memset(&rp, 0, sizeof(rp)); + if (cp->addr.type == BDADDR_BREDR) { br_params = hci_bdaddr_list_lookup_with_flags(&hdev->whitelist, &cp->addr.bdaddr,