From 7b214aa2332c2393f4f2c4024405f60951a5c2ba Mon Sep 17 00:00:00 2001 From: Mike Pagano Date: Tue, 6 Feb 2024 10:37:54 -0500 Subject: Fix-up unintentional patch overwrite Signed-off-by: Mike Pagano --- ...zes-only-if-Secure-Simple-Pairing-enabled.patch | 105 +++++++-------------- 2700_solo6x10-mem-resource-reduction-fix.patch | 70 ++++++++++++++ 2 files changed, 106 insertions(+), 69 deletions(-) create mode 100644 2700_solo6x10-mem-resource-reduction-fix.patch 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 -+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 -+Closes: https://lore.kernel.org/lkml/18c6df0d-45ed-450c-9eda-95160a2bbb8e@gmail.com/ -+Cc: # v6.7+ -+Suggested-by: David Laight -+Signed-off-by: Aurelien Jarno -+Reviewed-by: David Laight -+Reviewed-by: Hans Verkuil -+Signed-off-by: Linus Torvalds -+--- -+ 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 +Cc: stable@vger.kernel.org +--- + 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/2700_solo6x10-mem-resource-reduction-fix.patch b/2700_solo6x10-mem-resource-reduction-fix.patch new file mode 100644 index 00000000..a0b55a8c --- /dev/null +++ b/2700_solo6x10-mem-resource-reduction-fix.patch @@ -0,0 +1,70 @@ +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 ++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 ++Closes: https://lore.kernel.org/lkml/18c6df0d-45ed-450c-9eda-95160a2bbb8e@gmail.com/ ++Cc: # v6.7+ ++Suggested-by: David Laight ++Signed-off-by: Aurelien Jarno ++Reviewed-by: David Laight ++Reviewed-by: Hans Verkuil ++Signed-off-by: Linus Torvalds ++--- ++ 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 + -- cgit v1.2.3-65-gdbad