From: kernel test robot <lkp@intel.com>
To: oe-kbuild@lists.linux.dev
Cc: lkp@intel.com, Dan Carpenter <error27@gmail.com>
Subject: [pkshih-rtw:rtw-next 22/40] net/wireless/nl80211.c:267 nl80211_lock_and_recheck() warn: inconsistent returns '&rdev->wiphy.mtx'.
Date: Sun, 11 Oct 2026 10:15:35 +0200 [thread overview]
Message-ID: <202610111016.9wexeSaG-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
TO: Johannes Berg <johannes.berg@intel.com>
tree: https://github.com/pkshih/rtw rtw-next
head: fbfa27d9b06f025c5f2cfa79d0e01e6400eeff2a
commit: 8e3d9039d280c61e1ef5c5cbe8ee8db342907173 [22/40] wifi: nl80211: avoid rtnl for commands that don't want it
:::::: branch date: 25 hours ago
:::::: commit date: 2 days ago
config: x86_64-randconfig-r2202-20261011 (https://download.01.org/0day-ci/archive/20261011/202610111016.9wexeSaG-lkp@intel.com/config)
compiler: clang version 22.1.8 (https://github.com/llvm/llvm-project ca7933e47d3a3451d81e72ac174dcb5aa28b59d1)
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/202610111016.9wexeSaG-lkp@intel.com/
New smatch warnings:
net/wireless/nl80211.c:267 nl80211_lock_and_recheck() warn: inconsistent returns '&rdev->wiphy.mtx'.
Old smatch warnings:
net/wireless/nl80211.c:4843 nl80211_send_iface() error: we previously assumed 'rdev->ops->get_channel' could be null (see line 4766)
vim +267 net/wireless/nl80211.c
a9455408b09395 Johannes Berg 2012-06-15 227
8e3d9039d280c6 Johannes Berg 2026-10-06 228 /*
8e3d9039d280c6 Johannes Berg 2026-10-06 229 * Lock the given wiphy, put the device and double-check it's
8e3d9039d280c6 Johannes Berg 2026-10-06 230 * still valid to use.
8e3d9039d280c6 Johannes Berg 2026-10-06 231 *
8e3d9039d280c6 Johannes Berg 2026-10-06 232 * Returns with wiphy mutex held unless there was an error.
8e3d9039d280c6 Johannes Berg 2026-10-06 233 */
8e3d9039d280c6 Johannes Berg 2026-10-06 234 static struct wireless_dev *
8e3d9039d280c6 Johannes Berg 2026-10-06 235 nl80211_lock_and_recheck(struct cfg80211_registered_device *rdev,
8e3d9039d280c6 Johannes Berg 2026-10-06 236 struct net *netns, u32 wdev_id)
8e3d9039d280c6 Johannes Berg 2026-10-06 237 {
8e3d9039d280c6 Johannes Berg 2026-10-06 238 struct wireless_dev *wdev;
8e3d9039d280c6 Johannes Berg 2026-10-06 239
8e3d9039d280c6 Johannes Berg 2026-10-06 240 wiphy_lock(&rdev->wiphy);
8e3d9039d280c6 Johannes Berg 2026-10-06 241
8e3d9039d280c6 Johannes Berg 2026-10-06 242 if (!rdev->wiphy.registered ||
8e3d9039d280c6 Johannes Berg 2026-10-06 243 !net_eq(wiphy_net(&rdev->wiphy), netns)) {
8e3d9039d280c6 Johannes Berg 2026-10-06 244 wiphy_unlock(&rdev->wiphy);
8e3d9039d280c6 Johannes Berg 2026-10-06 245 put_device(&rdev->wiphy.dev);
8e3d9039d280c6 Johannes Berg 2026-10-06 246 return ERR_PTR(-ENODEV);
8e3d9039d280c6 Johannes Berg 2026-10-06 247 }
8e3d9039d280c6 Johannes Berg 2026-10-06 248
8e3d9039d280c6 Johannes Berg 2026-10-06 249 /*
8e3d9039d280c6 Johannes Berg 2026-10-06 250 * unregistration blocks on wiphy mutex,
8e3d9039d280c6 Johannes Berg 2026-10-06 251 * so we don't need this now
8e3d9039d280c6 Johannes Berg 2026-10-06 252 */
8e3d9039d280c6 Johannes Berg 2026-10-06 253 put_device(&rdev->wiphy.dev);
8e3d9039d280c6 Johannes Berg 2026-10-06 254
8e3d9039d280c6 Johannes Berg 2026-10-06 255 if (!wdev_id)
8e3d9039d280c6 Johannes Berg 2026-10-06 256 return NULL;
8e3d9039d280c6 Johannes Berg 2026-10-06 257
8e3d9039d280c6 Johannes Berg 2026-10-06 258 list_for_each_entry(wdev, &rdev->wiphy.wdev_list, list) {
8e3d9039d280c6 Johannes Berg 2026-10-06 259 if (wdev->identifier != wdev_id)
8e3d9039d280c6 Johannes Berg 2026-10-06 260 continue;
8e3d9039d280c6 Johannes Berg 2026-10-06 261 if (wdev->netdev && !net_eq(dev_net(wdev->netdev), netns))
8e3d9039d280c6 Johannes Berg 2026-10-06 262 break;
8e3d9039d280c6 Johannes Berg 2026-10-06 263 return wdev;
8e3d9039d280c6 Johannes Berg 2026-10-06 264 }
8e3d9039d280c6 Johannes Berg 2026-10-06 265 wiphy_unlock(&rdev->wiphy);
8e3d9039d280c6 Johannes Berg 2026-10-06 266
8e3d9039d280c6 Johannes Berg 2026-10-06 @267 return ERR_PTR(-ENODEV);
8e3d9039d280c6 Johannes Berg 2026-10-06 268 }
8e3d9039d280c6 Johannes Berg 2026-10-06 269
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
reply other threads:[~2026-10-11 8:16 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=202610111016.9wexeSaG-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.