From: kernel test robot <lkp@intel.com>
To: oe-kbuild@lists.linux.dev
Cc: lkp@intel.com, Dan Carpenter <error27@gmail.com>
Subject: [bluetooth:master 84/88] net/bluetooth/hci_sync.c:1940 hci_adv_bcast_annoucement() warn: missing error code 'err'
Date: Fri, 20 Nov 2026 00:15:21 +0100 [thread overview]
Message-ID: <20261120000952.fVZj2a5L-lkp@intel.com> (raw)
Unfiltered warning: this smatch report is sent as-is and has not been
reviewed for false positives, so please treat it with due skepticism.
BCC: lkp@intel.com
CC: oe-kbuild-all@lists.linux.dev
CC: linux-bluetooth@vger.kernel.org
TO: Cen Zhang <zzzccc427@gmail.com>
CC: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
tree: https://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth.git master
head: 5052141b19fe0ab2863a12a0dcffac9aac6c8006
commit: d7e77168da348d8ac0fdb3b3aa7ce1ccc83208a7 [84/88] Bluetooth: hci_sync: Fix remaining advertising instance UAFs
:::::: branch date: 5 hours ago
:::::: commit date: 5 hours ago
config: hexagon-randconfig-2200-20261119 (https://download.01.org/0day-ci/archive/20261120/20261120000952.fVZj2a5L-lkp@intel.com/config)
compiler: clang version 17.0.6 (https://github.com/llvm/llvm-project 6009708b4367171ccdbf4b5905cb6a803753fe18)
smatch: v0.5.0-9187-g5189e3fb
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Reported-by: Dan Carpenter <error27@gmail.com>
| Closes: https://lore.kernel.org/r/20261120000952.fVZj2a5L-lkp@intel.com/
smatch warnings:
net/bluetooth/hci_sync.c:1940 hci_adv_bcast_annoucement() warn: missing error code 'err'
vim +/err +1940 net/bluetooth/hci_sync.c
eca0ae4aea6691 Luiz Augusto von Dentz 2022-03-09 1914
eca0ae4aea6691 Luiz Augusto von Dentz 2022-03-09 1915 /* Checks if periodic advertising data contains a Basic Announcement and if it
eca0ae4aea6691 Luiz Augusto von Dentz 2022-03-09 1916 * does generates a Broadcast ID and add Broadcast Announcement.
eca0ae4aea6691 Luiz Augusto von Dentz 2022-03-09 1917 */
d7e77168da348d Cen Zhang 2026-11-19 1918 static int hci_adv_bcast_annoucement(struct hci_dev *hdev, u8 instance)
eca0ae4aea6691 Luiz Augusto von Dentz 2022-03-09 1919 {
d7e77168da348d Cen Zhang 2026-11-19 1920 struct adv_info *adv;
eca0ae4aea6691 Luiz Augusto von Dentz 2022-03-09 1921 u8 bid[3];
5725bc60825205 Luiz Augusto von Dentz 2025-06-05 1922 u8 ad[HCI_MAX_EXT_AD_LENGTH];
5725bc60825205 Luiz Augusto von Dentz 2025-06-05 1923 u8 len;
d7e77168da348d Cen Zhang 2026-11-19 1924 int err = 0;
eca0ae4aea6691 Luiz Augusto von Dentz 2022-03-09 1925
d7e77168da348d Cen Zhang 2026-11-19 1926 /* Skip if instance 0x00 as it is used for general purpose
eca0ae4aea6691 Luiz Augusto von Dentz 2022-03-09 1927 * advertising so it cannot used for the likes of Broadcast Announcement
eca0ae4aea6691 Luiz Augusto von Dentz 2022-03-09 1928 * as it can be overwritten at any point.
eca0ae4aea6691 Luiz Augusto von Dentz 2022-03-09 1929 */
d7e77168da348d Cen Zhang 2026-11-19 1930 if (!instance)
eca0ae4aea6691 Luiz Augusto von Dentz 2022-03-09 1931 return 0;
eca0ae4aea6691 Luiz Augusto von Dentz 2022-03-09 1932
d7e77168da348d Cen Zhang 2026-11-19 1933 hci_dev_lock(hdev);
d7e77168da348d Cen Zhang 2026-11-19 1934
d7e77168da348d Cen Zhang 2026-11-19 1935 /* The instance may have been removed while waiting for the
d7e77168da348d Cen Zhang 2026-11-19 1936 * controller, in which case there is nothing to announce.
d7e77168da348d Cen Zhang 2026-11-19 1937 */
d7e77168da348d Cen Zhang 2026-11-19 1938 adv = hci_find_adv_instance(hdev, instance);
d7e77168da348d Cen Zhang 2026-11-19 1939 if (!adv)
d7e77168da348d Cen Zhang 2026-11-19 @1940 goto unlock;
d7e77168da348d Cen Zhang 2026-11-19 1941
eca0ae4aea6691 Luiz Augusto von Dentz 2022-03-09 1942 /* Check if PA data doesn't contains a Basic Audio Announcement then
eca0ae4aea6691 Luiz Augusto von Dentz 2022-03-09 1943 * there is nothing to do.
eca0ae4aea6691 Luiz Augusto von Dentz 2022-03-09 1944 */
eca0ae4aea6691 Luiz Augusto von Dentz 2022-03-09 1945 if (!eir_get_service_data(adv->per_adv_data, adv->per_adv_data_len,
eca0ae4aea6691 Luiz Augusto von Dentz 2022-03-09 1946 0x1851, NULL))
d7e77168da348d Cen Zhang 2026-11-19 1947 goto unlock;
eca0ae4aea6691 Luiz Augusto von Dentz 2022-03-09 1948
eca0ae4aea6691 Luiz Augusto von Dentz 2022-03-09 1949 /* Check if advertising data already has a Broadcast Announcement since
eca0ae4aea6691 Luiz Augusto von Dentz 2022-03-09 1950 * the process may want to control the Broadcast ID directly and in that
eca0ae4aea6691 Luiz Augusto von Dentz 2022-03-09 1951 * case the kernel shall no interfere.
eca0ae4aea6691 Luiz Augusto von Dentz 2022-03-09 1952 */
eca0ae4aea6691 Luiz Augusto von Dentz 2022-03-09 1953 if (eir_get_service_data(adv->adv_data, adv->adv_data_len, 0x1852,
eca0ae4aea6691 Luiz Augusto von Dentz 2022-03-09 1954 NULL))
d7e77168da348d Cen Zhang 2026-11-19 1955 goto unlock;
eca0ae4aea6691 Luiz Augusto von Dentz 2022-03-09 1956
eca0ae4aea6691 Luiz Augusto von Dentz 2022-03-09 1957 /* Generate Broadcast ID */
eca0ae4aea6691 Luiz Augusto von Dentz 2022-03-09 1958 get_random_bytes(bid, sizeof(bid));
5725bc60825205 Luiz Augusto von Dentz 2025-06-05 1959 len = eir_append_service_data(ad, 0, 0x1852, bid, sizeof(bid));
5c65b96b549ea2 Yuqi Xu 2026-05-29 1960 if (adv->adv_data_len > sizeof(ad) - len) {
5c65b96b549ea2 Yuqi Xu 2026-05-29 1961 bt_dev_err(hdev, "No room for Broadcast Announcement");
d7e77168da348d Cen Zhang 2026-11-19 1962 err = -EINVAL;
d7e77168da348d Cen Zhang 2026-11-19 1963 goto unlock;
5c65b96b549ea2 Yuqi Xu 2026-05-29 1964 }
5c65b96b549ea2 Yuqi Xu 2026-05-29 1965
5725bc60825205 Luiz Augusto von Dentz 2025-06-05 1966 memcpy(ad + len, adv->adv_data, adv->adv_data_len);
d7e77168da348d Cen Zhang 2026-11-19 1967 hci_set_adv_instance_data(hdev, instance, len + adv->adv_data_len,
5725bc60825205 Luiz Augusto von Dentz 2025-06-05 1968 ad, 0, NULL);
eca0ae4aea6691 Luiz Augusto von Dentz 2022-03-09 1969
d7e77168da348d Cen Zhang 2026-11-19 1970 hci_dev_unlock(hdev);
d7e77168da348d Cen Zhang 2026-11-19 1971
d7e77168da348d Cen Zhang 2026-11-19 1972 return hci_update_adv_data_sync(hdev, instance);
d7e77168da348d Cen Zhang 2026-11-19 1973
d7e77168da348d Cen Zhang 2026-11-19 1974 unlock:
d7e77168da348d Cen Zhang 2026-11-19 1975 hci_dev_unlock(hdev);
d7e77168da348d Cen Zhang 2026-11-19 1976 return err;
eca0ae4aea6691 Luiz Augusto von Dentz 2022-03-09 1977 }
eca0ae4aea6691 Luiz Augusto von Dentz 2022-03-09 1978
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
reply other threads:[~2026-11-19 23:15 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261120000952.fVZj2a5L-lkp@intel.com \
--to=lkp@intel.com \
--cc=error27@gmail.com \
--cc=oe-kbuild@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.