Skip to contentSkip to conversation

net/bluetooth/mgmt.c:5400:59: sparse: sparse: incorrect type in argument 3 (different base types)

PATCH kernel test robot 1 participant 1 message Jun 5, 2025

lore
Share & tools
lore

kernel test robot

author build bot
#0 lore raw
tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head:   4f27f06ec12190c7c62c722e99ab6243dea81a94
commit: 5db6a9a0d4444b3c213bddf0947ce3c60f25c760 [14198/14443] Bluetooth: MGMT: Fix UAF on mgmt_remove_adv_monitor_complete
config: i386-randconfig-061-20250605 (https://download.01.org/0day-ci/archive/20250606/[email protected]/config)
compiler: clang version 20.1.2 (https://github.com/llvm/llvm-project 58df0ef89dd64126512e4ee27b4ac3fd8ddf6247)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250606/[email protected]/reproduce)

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 <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

sparse warnings: (new ones prefixed by >>)

>> net/bluetooth/mgmt.c:5400:59: sparse: sparse: incorrect type in argument 3 (different base types) @@     expected unsigned short [usertype] handle @@     got restricted __le16 [usertype] monitor_handle @@

net/bluetooth/mgmt.c:5400:59: sparse: expected unsigned short [usertype] handle
net/bluetooth/mgmt.c:5400:59: sparse: got restricted __le16 [usertype] monitor_handle

vim +5400 net/bluetooth/mgmt.c

5382
5383 static void mgmt_remove_adv_monitor_complete(struct hci_dev *hdev,
5384 void *data, int status)
5385 {
5386 struct mgmt_rp_remove_adv_monitor rp;
5387 struct mgmt_pending_cmd *cmd = data;
5388 struct mgmt_cp_remove_adv_monitor *cp;
5389
5390 if (status == -ECANCELED)
5391 return;
5392
5393 hci_dev_lock(hdev);
5394
5395 cp = cmd->param;
5396
5397 rp.monitor_handle = cp->monitor_handle;
5398
5399 if (!status) {

> 5400			mgmt_adv_monitor_removed(cmd->sk, hdev, cp->monitor_handle);

5401 hci_update_passive_scan(hdev);
5402 }
5403
5404 mgmt_cmd_complete(cmd->sk, cmd->index, cmd->opcode,
5405 mgmt_status(status), &rp, sizeof(rp));
5406 mgmt_pending_free(cmd);
5407
5408 hci_dev_unlock(hdev);
5409 bt_dev_dbg(hdev, "remove monitor %d complete, status %d",
5410 rp.monitor_handle, status);
5411 }
5412

Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki