commit:     7b214aa2332c2393f4f2c4024405f60951a5c2ba
Author:     Mike Pagano <mpagano <AT> gentoo <DOT> org>
AuthorDate: Tue Feb  6 15:37:54 2024 +0000
Commit:     Mike Pagano <mpagano <AT> gentoo <DOT> org>
CommitDate: Tue Feb  6 15:37:54 2024 +0000
URL:        https://gitweb.gentoo.org/proj/linux-patches.git/commit/?id=7b214aa2

Fix-up unintentional patch overwrite

Signed-off-by: Mike Pagano <mpagano <AT> gentoo.org>

 ...zes-only-if-Secure-Simple-Pairing-enabled.patch | 105 +++++++--------------
 ... 2700_solo6x10-mem-resource-reduction-fix.patch |   0
 2 files changed, 36 insertions(+), 69 deletions(-)

diff --git 
a/2000_BT-Check-key-sizes-only-if-Secure-Simple-Pairing-enabled.patch 
b/2000_BT-Check-key-sizes-only-if-Secure-Simple-Pairing-enabled.patch
index a0b55a8c..394ad48f 100644
--- a/2000_BT-Check-key-sizes-only-if-Secure-Simple-Pairing-enabled.patch
+++ b/2000_BT-Check-key-sizes-only-if-Secure-Simple-Pairing-enabled.patch
@@ -1,70 +1,37 @@
-diff --git a/2700_solo6x10-mem-resource-reduction-fix.patch 
b/2700_solo6x10-mem-resource-reduction-fix.patch
-new file mode 100644
-index 00000000..bf406a92
---- /dev/null
-+++ b/2700_solo6x10-mem-resource-reduction-fix.patch
-@@ -0,0 +1,61 @@
-+From 31e97d7c9ae3de072d7b424b2cf706a03ec10720 Mon Sep 17 00:00:00 2001
-+From: Aurelien Jarno <[email protected]>
-+Date: Sat, 13 Jan 2024 19:33:31 +0100
-+Subject: media: solo6x10: replace max(a, min(b, c)) by clamp(b, a, c)
-+
-+This patch replaces max(a, min(b, c)) by clamp(b, a, c) in the solo6x10
-+driver.  This improves the readability and more importantly, for the
-+solo6x10-p2m.c file, this reduces on my system (x86-64, gcc 13):
-+
-+ - the preprocessed size from 121 MiB to 4.5 MiB;
-+
-+ - the build CPU time from 46.8 s to 1.6 s;
-+
-+ - the build memory from 2786 MiB to 98MiB.
-+
-+In fine, this allows this relatively simple C file to be built on a
-+32-bit system.
-+
-+Reported-by: Jiri Slaby <[email protected]>
-+Closes: 
https://lore.kernel.org/lkml/[email protected]/
-+Cc:  <[email protected]> # v6.7+
-+Suggested-by: David Laight <[email protected]>
-+Signed-off-by: Aurelien Jarno <[email protected]>
-+Reviewed-by: David Laight <[email protected]>
-+Reviewed-by: Hans Verkuil <[email protected]>
-+Signed-off-by: Linus Torvalds <[email protected]>
-+---
-+ drivers/media/pci/solo6x10/solo6x10-offsets.h | 10 +++++-----
-+ 1 file changed, 5 insertions(+), 5 deletions(-)
-+
-+(limited to 'drivers/media/pci/solo6x10/solo6x10-offsets.h')
-+
-+diff --git a/drivers/media/pci/solo6x10/solo6x10-offsets.h 
b/drivers/media/pci/solo6x10/solo6x10-offsets.h
-+index f414ee1316f29c..fdbb817e63601c 100644
-+--- a/drivers/media/pci/solo6x10/solo6x10-offsets.h
-++++ b/drivers/media/pci/solo6x10/solo6x10-offsets.h
-+@@ -57,16 +57,16 @@
-+ #define SOLO_MP4E_EXT_ADDR(__solo) \
-+      (SOLO_EREF_EXT_ADDR(__solo) + SOLO_EREF_EXT_AREA(__solo))
-+ #define SOLO_MP4E_EXT_SIZE(__solo) \
-+-     max((__solo->nr_chans * 0x00080000),                            \
-+-         min(((__solo->sdram_size - SOLO_MP4E_EXT_ADDR(__solo)) -    \
-+-              __SOLO_JPEG_MIN_SIZE(__solo)), 0x00ff0000))
-++     clamp(__solo->sdram_size - SOLO_MP4E_EXT_ADDR(__solo) - \
-++           __SOLO_JPEG_MIN_SIZE(__solo),                     \
-++           __solo->nr_chans * 0x00080000, 0x00ff0000)
-+ 
-+ #define __SOLO_JPEG_MIN_SIZE(__solo)         (__solo->nr_chans * 0x00080000)
-+ #define SOLO_JPEG_EXT_ADDR(__solo) \
-+              (SOLO_MP4E_EXT_ADDR(__solo) + SOLO_MP4E_EXT_SIZE(__solo))
-+ #define SOLO_JPEG_EXT_SIZE(__solo) \
-+-     max(__SOLO_JPEG_MIN_SIZE(__solo),                               \
-+-         min((__solo->sdram_size - SOLO_JPEG_EXT_ADDR(__solo)), 0x00ff0000))
-++     clamp(__solo->sdram_size - SOLO_JPEG_EXT_ADDR(__solo),  \
-++           __SOLO_JPEG_MIN_SIZE(__solo), 0x00ff0000)
-+ 
-+ #define SOLO_SDRAM_END(__solo) \
-+      (SOLO_JPEG_EXT_ADDR(__solo) + SOLO_JPEG_EXT_SIZE(__solo))
-+-- 
-+cgit 1.2.3-korg
-+
--- 
-cgit v1.2.3
+The encryption is only mandatory to be enforced when both sides are using
+Secure Simple Pairing and this means the key size check makes only sense
+in that case.
 
+On legacy Bluetooth 2.0 and earlier devices like mice the encryption was
+optional and thus causing an issue if the key size check is not bound to
+using Secure Simple Pairing.
+
+Fixes: d5bb334a8e17 ("Bluetooth: Align minimum encryption key size for LE and 
BR/EDR connections")
+Signed-off-by: Marcel Holtmann <[email protected]>
+Cc: [email protected]
+---
+ net/bluetooth/hci_conn.c | 9 +++++++--
+ 1 file changed, 7 insertions(+), 2 deletions(-)
+
+diff --git a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c
+index 3cf0764d5793..7516cdde3373 100644
+--- a/net/bluetooth/hci_conn.c
++++ b/net/bluetooth/hci_conn.c
+@@ -1272,8 +1272,13 @@ int hci_conn_check_link_mode(struct hci_conn *conn)
+                       return 0;
+       }
+ 
+-      if (hci_conn_ssp_enabled(conn) &&
+-          !test_bit(HCI_CONN_ENCRYPT, &conn->flags))
++      /* If Secure Simple Pairing is not enabled, then legacy connection
++       * setup is used and no encryption or key sizes can be enforced.
++       */
++      if (!hci_conn_ssp_enabled(conn))
++              return 1;
++
++      if (!test_bit(HCI_CONN_ENCRYPT, &conn->flags))
+               return 0;
+ 
+       /* The minimum encryption key size needs to be enforced by the
+-- 
+2.20.1

diff --git 
a/2000_BT-Check-key-sizes-only-if-Secure-Simple-Pairing-enabled.patch 
b/2700_solo6x10-mem-resource-reduction-fix.patch
similarity index 100%
copy from 2000_BT-Check-key-sizes-only-if-Secure-Simple-Pairing-enabled.patch
copy to 2700_solo6x10-mem-resource-reduction-fix.patch

Reply via email to