linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@linaro.org>
To: oe-kbuild@lists.linux.dev, Arnd Bergmann <arnd@arndb.de>
Cc: lkp@intel.com, oe-kbuild-all@lists.linux.dev,
	Linux Memory Management List <linux-mm@kvack.org>,
	Luiz Augusto von Dentz <luiz.von.dentz@intel.com>,
	Kees Cook <keescook@chromium.org>
Subject: [linux-next:master 10943/11428] net/bluetooth/hci_event.c:3276 hci_conn_request_evt() warn: variable dereferenced before check 'hdev' (see line 3266)
Date: Wed, 11 Oct 2023 20:26:39 +0300	[thread overview]
Message-ID: <c5ac77c2-0cea-4262-a5b5-223d2edb17a9@kadam.mountain> (raw)

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head:   2933a1156742d8c47550493a77af8e2d81cf3c84
commit: b8ba8e65e84b99d58e278900b4261ef17a20eb27 [10943/11428] Bluetooth: avoid memcmp() out of bounds warning
config: i386-randconfig-141-20231011 (https://download.01.org/0day-ci/archive/20231012/202310120031.J3PSRP8D-lkp@intel.com/config)
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
reproduce: (https://download.01.org/0day-ci/archive/20231012/202310120031.J3PSRP8D-lkp@intel.com/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 <lkp@intel.com>
| Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
| Closes: https://lore.kernel.org/r/202310120031.J3PSRP8D-lkp@intel.com/

smatch warnings:
net/bluetooth/hci_event.c:3276 hci_conn_request_evt() warn: variable dereferenced before check 'hdev' (see line 3266)

vim +/hdev +3276 net/bluetooth/hci_event.c

3e54c5890c87a3 Luiz Augusto von Dentz 2021-12-01  3262  static void hci_conn_request_evt(struct hci_dev *hdev, void *data,
3e54c5890c87a3 Luiz Augusto von Dentz 2021-12-01  3263  				 struct sk_buff *skb)
^1da177e4c3f41 Linus Torvalds         2005-04-16  3264  {
3e54c5890c87a3 Luiz Augusto von Dentz 2021-12-01  3265  	struct hci_ev_conn_request *ev = data;
a9de9248064bfc Marcel Holtmann        2007-10-20 @3266  	int mask = hdev->link_mode;
                                                                           ^^^^^^^^^^^^^^^
Dereference

70c464256310e1 Johan Hedberg          2014-07-09  3267  	struct inquiry_entry *ie;
70c464256310e1 Johan Hedberg          2014-07-09  3268  	struct hci_conn *conn;
20714bfef84d3e Frédéric Dalleau       2012-11-21  3269  	__u8 flags = 0;
^1da177e4c3f41 Linus Torvalds         2005-04-16  3270  
3e54c5890c87a3 Luiz Augusto von Dentz 2021-12-01  3271  	bt_dev_dbg(hdev, "bdaddr %pMR type 0x%x", &ev->bdaddr, ev->link_type);
^1da177e4c3f41 Linus Torvalds         2005-04-16  3272  
d70e44fef8621a Lee, Chun-Yi           2023-10-01  3273  	/* Reject incoming connection from device with same BD ADDR against
d70e44fef8621a Lee, Chun-Yi           2023-10-01  3274  	 * CVE-2020-26555
d70e44fef8621a Lee, Chun-Yi           2023-10-01  3275  	 */
b8ba8e65e84b99 Arnd Bergmann          2023-10-09 @3276  	if (hdev && !bacmp(&hdev->bdaddr, &ev->bdaddr)) {
                                                                    ^^^^
Checked too late

d70e44fef8621a Lee, Chun-Yi           2023-10-01  3277  		bt_dev_dbg(hdev, "Reject connection with same BD_ADDR %pMR\n",
d70e44fef8621a Lee, Chun-Yi           2023-10-01  3278  			   &ev->bdaddr);
d70e44fef8621a Lee, Chun-Yi           2023-10-01  3279  		hci_reject_conn(hdev, &ev->bdaddr);
d70e44fef8621a Lee, Chun-Yi           2023-10-01  3280  		return;

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



                 reply	other threads:[~2023-10-11 17:26 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=c5ac77c2-0cea-4262-a5b5-223d2edb17a9@kadam.mountain \
    --to=dan.carpenter@linaro.org \
    --cc=arnd@arndb.de \
    --cc=keescook@chromium.org \
    --cc=linux-mm@kvack.org \
    --cc=lkp@intel.com \
    --cc=luiz.von.dentz@intel.com \
    --cc=oe-kbuild-all@lists.linux.dev \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox