mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: Mohammed Alquraini <mohammed.saad.alquraini@gmail.com>,
	linux-bluetooth@vger.kernel.org
Cc: llvm@lists.linux.dev, oe-kbuild-all@lists.linux.dev,
	Marcel Holtmann <marcel@holtmann.org>,
	Luiz Augusto von Dentz <luiz.dentz@gmail.com>,
	linux-kernel@vger.kernel.org,
	Mohammed Alquraini <mohammed.saad.alquraini@gmail.com>
Subject: Re: [PATCH] Bluetooth: L2CAP: check security before completing a deferred BR/EDR accept
Date: Thu, 19 Nov 2026 18:01:43 +0800	[thread overview]
Message-ID: <202611191741.wWf1jeoY-lkp@intel.com> (raw)
In-Reply-To: <20261118213322.60067-1-mohammed.saad.alquraini@gmail.com>

Hi Mohammed,

kernel test robot noticed the following build warnings:

[auto build test WARNING on bluetooth/master]
[also build test WARNING on bluetooth-next/master linus/master v7.4-rc3 next-20261116]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Mohammed-Alquraini/Bluetooth-L2CAP-check-security-before-completing-a-deferred-BR-EDR-accept/20261119-003322
base:   https://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth.git master
patch link:    https://lore.kernel.org/r/20261118213322.60067-1-mohammed.saad.alquraini%40gmail.com
patch subject: [PATCH] Bluetooth: L2CAP: check security before completing a deferred BR/EDR accept
config: loongarch-defconfig (https://download.01.org/0day-ci/archive/20261119/202611191741.wWf1jeoY-lkp@intel.com/config)
compiler: clang version 24.0.0git (https://github.com/llvm/llvm-project 3b14d7c370558b46e5f0c6494a05c492e59bf32c)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20261119/202611191741.wWf1jeoY-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>
| Closes: https://lore.kernel.org/oe-kbuild-all/202611191741.wWf1jeoY-lkp@intel.com/

All warnings (new ones prefixed by >>):

>> net/bluetooth/l2cap_sock.c:1256:14: warning: acquiring mutex 'sk->chan->conn->lock' that is already held [-Wthread-safety-analysis]
    1256 |         have_conn = l2cap_chan_lock_conn(chan);
         |                     ^
   net/bluetooth/l2cap_sock.c:1256:14: note: mutex acquired here
>> net/bluetooth/l2cap_sock.c:1281:5: warning: mutex 'sk->chan->conn->lock' is not held on every path through here [-Wthread-safety-analysis]
    1281 |                                 l2cap_chan_unlock_conn(chan, have_conn);
         |                                 ^
   include/net/bluetooth/l2cap.h:1016:2: note: expanded from macro 'l2cap_chan_unlock_conn'
    1016 |         ({                                                              \
         |         ^
   net/bluetooth/l2cap_sock.c:1256:14: note: mutex acquired here
    1256 |         have_conn = l2cap_chan_lock_conn(chan);
         |                     ^
   2 warnings generated.


vim +1256 net/bluetooth/l2cap_sock.c

ce60b9231b66710 Sebastian Urban        2024-05-01  1241  
32d86e048d8efed Pauli Virtanen         2026-08-29  1242  static int l2cap_sock_defer(struct sock *sk)
6898325923f9571 Gustavo Padovan        2011-02-04  1243  {
32d86e048d8efed Pauli Virtanen         2026-08-29  1244  	struct l2cap_chan *chan = l2cap_pi(sk)->chan;
32d86e048d8efed Pauli Virtanen         2026-08-29  1245  	bool have_conn;
32d86e048d8efed Pauli Virtanen         2026-08-29  1246  	int err = 0;
6898325923f9571 Gustavo Padovan        2011-02-04  1247  
32d86e048d8efed Pauli Virtanen         2026-08-29  1248  	/* Fast path check */
32d86e048d8efed Pauli Virtanen         2026-08-29  1249  	lock_sock(sk);
32d86e048d8efed Pauli Virtanen         2026-08-29  1250  	if (sk->sk_state != BT_CONNECT2) {
32d86e048d8efed Pauli Virtanen         2026-08-29  1251  		release_sock(sk);
32d86e048d8efed Pauli Virtanen         2026-08-29  1252  		return 0;
32d86e048d8efed Pauli Virtanen         2026-08-29  1253  	}
32d86e048d8efed Pauli Virtanen         2026-08-29  1254  	release_sock(sk);
11770f41b8a7e12 Pauli Virtanen         2025-03-18  1255  
32d86e048d8efed Pauli Virtanen         2026-08-29 @1256  	have_conn = l2cap_chan_lock_conn(chan);
6898325923f9571 Gustavo Padovan        2011-02-04  1257  	lock_sock(sk);
6898325923f9571 Gustavo Padovan        2011-02-04  1258  
c5daa683f2d3315 Gustavo Padovan        2012-05-16  1259  	if (sk->sk_state == BT_CONNECT2 && test_bit(BT_SK_DEFER_SETUP,
c5daa683f2d3315 Gustavo Padovan        2012-05-16  1260  						    &bt_sk(sk)->flags)) {
32d86e048d8efed Pauli Virtanen         2026-08-29  1261  		err = 1;
32d86e048d8efed Pauli Virtanen         2026-08-29  1262  
32d86e048d8efed Pauli Virtanen         2026-08-29  1263  		if (!have_conn) {
32d86e048d8efed Pauli Virtanen         2026-08-29  1264  			release_sock(sk);
32d86e048d8efed Pauli Virtanen         2026-08-29  1265  			err = -ENOTCONN;
32d86e048d8efed Pauli Virtanen         2026-08-29  1266  		} else if (chan->mode == L2CAP_MODE_EXT_FLOWCTL) {
15f02b91056253e Luiz Augusto von Dentz 2020-03-02  1267  			sk->sk_state = BT_CONNECTED;
32d86e048d8efed Pauli Virtanen         2026-08-29  1268  			chan->state = BT_CONNECTED;
32d86e048d8efed Pauli Virtanen         2026-08-29  1269  			release_sock(sk);
32d86e048d8efed Pauli Virtanen         2026-08-29  1270  			__l2cap_ecred_conn_rsp_defer(chan);
32d86e048d8efed Pauli Virtanen         2026-08-29  1271  		} else if (bdaddr_type_is_le(chan->src_type)) {
3831971355d901c Johan Hedberg          2013-05-17  1272  			sk->sk_state = BT_CONNECTED;
32d86e048d8efed Pauli Virtanen         2026-08-29  1273  			chan->state = BT_CONNECTED;
32d86e048d8efed Pauli Virtanen         2026-08-29  1274  			release_sock(sk);
32d86e048d8efed Pauli Virtanen         2026-08-29  1275  			__l2cap_le_connect_rsp_defer(chan);
3831971355d901c Johan Hedberg          2013-05-17  1276  		} else {
e9a22bfeb7fdd1c Mohammed Alquraini     2026-11-19  1277  			/* Defer completion until security resolves. */
e9a22bfeb7fdd1c Mohammed Alquraini     2026-11-19  1278  			if (!l2cap_chan_check_security(chan, false)) {
e9a22bfeb7fdd1c Mohammed Alquraini     2026-11-19  1279  				set_bit(BT_SK_ACCEPTED, &bt_sk(sk)->flags);
e9a22bfeb7fdd1c Mohammed Alquraini     2026-11-19  1280  				release_sock(sk);
e9a22bfeb7fdd1c Mohammed Alquraini     2026-11-19 @1281  				l2cap_chan_unlock_conn(chan, have_conn);
e9a22bfeb7fdd1c Mohammed Alquraini     2026-11-19  1282  				return err;
e9a22bfeb7fdd1c Mohammed Alquraini     2026-11-19  1283  			}
8c1d787be4b62d2 Gustavo Padovan        2011-04-13  1284  			sk->sk_state = BT_CONFIG;
32d86e048d8efed Pauli Virtanen         2026-08-29  1285  			chan->state = BT_CONFIG;
32d86e048d8efed Pauli Virtanen         2026-08-29  1286  			release_sock(sk);
32d86e048d8efed Pauli Virtanen         2026-08-29  1287  			__l2cap_connect_rsp_defer(chan);
32d86e048d8efed Pauli Virtanen         2026-08-29  1288  		}
32d86e048d8efed Pauli Virtanen         2026-08-29  1289  	} else {
32d86e048d8efed Pauli Virtanen         2026-08-29  1290  		release_sock(sk);
3831971355d901c Johan Hedberg          2013-05-17  1291  	}
3831971355d901c Johan Hedberg          2013-05-17  1292  
32d86e048d8efed Pauli Virtanen         2026-08-29  1293  	l2cap_chan_unlock_conn(chan, have_conn);
32d86e048d8efed Pauli Virtanen         2026-08-29  1294  	return err;
6898325923f9571 Gustavo Padovan        2011-02-04  1295  }
6898325923f9571 Gustavo Padovan        2011-02-04  1296  

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

      parent reply	other threads:[~2026-11-19 10:02 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-18 21:33 Mohammed Alquraini
2026-11-18 23:04 ` Luiz Augusto von Dentz
2026-11-19 10:01 ` kernel test robot [this message]

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=202611191741.wWf1jeoY-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=llvm@lists.linux.dev \
    --cc=luiz.dentz@gmail.com \
    --cc=marcel@holtmann.org \
    --cc=mohammed.saad.alquraini@gmail.com \
    --cc=oe-kbuild-all@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

all inboxes | Powered by JetHome®