public inbox for linux-bluetooth@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH BlueZ v2 00/11] Fix bugs found by static analysis
@ 2025-07-08 11:08 Ismagil Iskakov
  2025-07-08 11:08 ` [PATCH BlueZ v2 01/11] btio: fix range validation of security level Ismagil Iskakov
                   ` (12 more replies)
  0 siblings, 13 replies; 21+ messages in thread
From: Ismagil Iskakov @ 2025-07-08 11:08 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Ismagil Iskakov

This patch corrects some of the bugs not connected
to the functionality but to memory management etc.
Two exceptions being about fixing the arguments
order, which also could've caused some trouble.

Ismagil Iskakov (11):
  btio: fix range validation of security level
  profiles/audio: add nullity checks
  src/shared: add nullity checks
  isotest: close fd after sending when nconn=1
  obexd/client: fix err condition causing memleak
  profiles/audio: fix memleak of bt_bap
  src/shared: fix memleak
  src/shared: move null checks before dereferencing
  isotest: remove repeating conditions
  profiles/audio: fix io_unlink args order
  src/plugin: fix args order

 btio/btio.c                |  2 +-
 obexd/client/transfer.c    |  2 +-
 profiles/audio/a2dp.c      | 45 +++++++++++++++++++++++++++++---------
 profiles/audio/avrcp.c     | 24 +++++++++++++++++---
 profiles/audio/bap.c       | 24 +++++++++++---------
 profiles/audio/bass.c      |  7 +++++-
 profiles/audio/transport.c |  2 +-
 src/plugin.c               |  2 +-
 src/shared/bap.c           | 40 ++++++++++++++++++++++++++++-----
 src/shared/gatt-db.c       |  5 ++++-
 src/shared/vcp.c           |  3 +++
 tools/isotest.c            |  8 ++++---
 12 files changed, 126 insertions(+), 38 deletions(-)

-- 
2.34.1


^ permalink raw reply	[flat|nested] 21+ messages in thread
* [PATCH BlueZ v4 1/4] btio: fix range validation of security level
@ 2025-07-09 13:36 Ismagil Iskakov
  2025-07-09 15:11 ` Fix bugs found by static analysis bluez.test.bot
  0 siblings, 1 reply; 21+ messages in thread
From: Ismagil Iskakov @ 2025-07-09 13:36 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Ismagil Iskakov

Arrays inside l2cap_set_lm/rfcomm_set_lm functions are of size 4,
but the bounds check allows the value 4 for 'level'.
---
 btio/btio.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/btio/btio.c b/btio/btio.c
index b8afe0580..bc14199f2 100644
--- a/btio/btio.c
+++ b/btio/btio.c
@@ -474,6 +474,12 @@ static gboolean set_sec_level(int sock, BtIOType type, int level, GError **err)
 		return FALSE;
 	}
 
+	if (level == BT_SECURITY_FIPS) {
+		g_set_error(err, BT_IO_ERROR, EINVAL,
+				"FIPS security level is not supported for L2CAP_LM/RFCOMM_LM");
+		return FALSE;
+	}
+
 	if (type == BT_IO_L2CAP)
 		ret = l2cap_set_lm(sock, level);
 	else
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 21+ messages in thread
* [PATCH BlueZ v3 1/4] btio: fix range validation of security level
@ 2025-07-09 12:18 Ismagil Iskakov
  2025-07-09 13:40 ` Fix bugs found by static analysis bluez.test.bot
  0 siblings, 1 reply; 21+ messages in thread
From: Ismagil Iskakov @ 2025-07-09 12:18 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Ismagil Iskakov

Arrays inside l2cap_set_lm/rfcomm_set_lm functions are of size 4,
but the bounds check allows the value 4 for 'level'.
---
 btio/btio.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/btio/btio.c b/btio/btio.c
index b8afe0580..bc14199f2 100644
--- a/btio/btio.c
+++ b/btio/btio.c
@@ -474,6 +474,12 @@ static gboolean set_sec_level(int sock, BtIOType type, int level, GError **err)
 		return FALSE;
 	}
 
+	if (level == BT_SECURITY_FIPS) {
+		g_set_error(err, BT_IO_ERROR, EINVAL,
+				"FIPS security level is not supported for L2CAP_LM/RFCOMM_LM");
+		return FALSE;
+	}
+
 	if (type == BT_IO_L2CAP)
 		ret = l2cap_set_lm(sock, level);
 	else
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 21+ messages in thread
* [PATCH BlueZ 01/11] btio: fix range validation of security level
@ 2025-07-08  7:33 Ismagil Iskakov
  2025-07-08  7:51 ` Fix bugs found by static analysis bluez.test.bot
  0 siblings, 1 reply; 21+ messages in thread
From: Ismagil Iskakov @ 2025-07-08  7:33 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Ismagil Iskakov

Arrays inside l2cap_set_lm/rfcomm_set_lm functions are of size 4,
but the bounds check allows the value 4 for 'level'.
---
 btio/btio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/btio/btio.c b/btio/btio.c
index b8afe0580..14f2b700e 100644
--- a/btio/btio.c
+++ b/btio/btio.c
@@ -455,7 +455,7 @@ static gboolean set_sec_level(int sock, BtIOType type, int level, GError **err)
 	struct bt_security sec;
 	int ret;
 
-	if (level < BT_SECURITY_LOW || level > BT_SECURITY_FIPS) {
+	if (level < BT_SECURITY_LOW || level > BT_SECURITY_HIGH) {
 		g_set_error(err, BT_IO_ERROR, EINVAL,
 				"Valid security level range is %d-%d",
 				BT_SECURITY_LOW, BT_SECURITY_HIGH);
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 21+ messages in thread

end of thread, other threads:[~2025-07-09 15:11 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-08 11:08 [PATCH BlueZ v2 00/11] Fix bugs found by static analysis Ismagil Iskakov
2025-07-08 11:08 ` [PATCH BlueZ v2 01/11] btio: fix range validation of security level Ismagil Iskakov
2025-07-08 12:44   ` Fix bugs found by static analysis bluez.test.bot
2025-07-08 14:18   ` [PATCH BlueZ v2 01/11] btio: fix range validation of security level Luiz Augusto von Dentz
2025-07-08 11:09 ` [PATCH BlueZ v2 02/11] profiles/audio: add nullity checks Ismagil Iskakov
2025-07-08 11:09 ` [PATCH BlueZ v2 03/11] src/shared: " Ismagil Iskakov
2025-07-08 11:09 ` [PATCH BlueZ v2 04/11] isotest: close fd after sending when nconn=1 Ismagil Iskakov
2025-07-08 11:09 ` [PATCH BlueZ v2 05/11] obexd/client: fix err condition causing memleak Ismagil Iskakov
2025-07-08 14:21   ` Luiz Augusto von Dentz
2025-07-08 11:09 ` [PATCH BlueZ v2 06/11] profiles/audio: fix memleak of bt_bap Ismagil Iskakov
2025-07-08 11:09 ` [PATCH BlueZ v2 07/11] src/shared: fix memleak Ismagil Iskakov
2025-07-08 11:09 ` [PATCH BlueZ v2 08/11] src/shared: move null checks before dereferencing Ismagil Iskakov
2025-07-08 11:09 ` [PATCH BlueZ v2 09/11] isotest: remove repeating conditions Ismagil Iskakov
2025-07-08 11:09 ` [PATCH BlueZ v2 10/11] profiles/audio: fix io_unlink args order Ismagil Iskakov
2025-07-08 14:33   ` Luiz Augusto von Dentz
2025-07-08 11:09 ` [PATCH BlueZ v2 11/11] src/plugin: fix " Ismagil Iskakov
2025-07-08 15:00 ` [PATCH BlueZ v2 00/11] Fix bugs found by static analysis patchwork-bot+bluetooth
2025-07-08 15:02 ` Luiz Augusto von Dentz
  -- strict thread matches above, loose matches on Subject: below --
2025-07-09 13:36 [PATCH BlueZ v4 1/4] btio: fix range validation of security level Ismagil Iskakov
2025-07-09 15:11 ` Fix bugs found by static analysis bluez.test.bot
2025-07-09 12:18 [PATCH BlueZ v3 1/4] btio: fix range validation of security level Ismagil Iskakov
2025-07-09 13:40 ` Fix bugs found by static analysis bluez.test.bot
2025-07-08  7:33 [PATCH BlueZ 01/11] btio: fix range validation of security level Ismagil Iskakov
2025-07-08  7:51 ` Fix bugs found by static analysis bluez.test.bot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox