From 5fb8657536afe96f21b6896ef43b20a68e1ee8b6 Mon Sep 17 00:00:00 2001 From: jc_gargma Date: Sat, 19 Oct 2019 12:05:42 -0700 Subject: Updated to 5.3.7.a --- ...-on-the-return-value-of-hidp_send_message.patch | 62 ++++ 60-linux.hook | 1 - PKGBUILD | 52 ++-- config.x86_64 | 313 +++++++++++++++++---- 4 files changed, 342 insertions(+), 86 deletions(-) create mode 100644 0002-Bluetooth-hidp-Fix-assumptions-on-the-return-value-of-hidp_send_message.patch diff --git a/0002-Bluetooth-hidp-Fix-assumptions-on-the-return-value-of-hidp_send_message.patch b/0002-Bluetooth-hidp-Fix-assumptions-on-the-return-value-of-hidp_send_message.patch new file mode 100644 index 0000000..f2bceca --- /dev/null +++ b/0002-Bluetooth-hidp-Fix-assumptions-on-the-return-value-of-hidp_send_message.patch @@ -0,0 +1,62 @@ +From 0bee55974a73eed4a9b9c9e87000df34117e7f69 Mon Sep 17 00:00:00 2001 +From: Dan Elkouby +Date: Fri, 6 Sep 2019 14:06:44 +0300 +Subject: Bluetooth: hidp: Fix assumptions on the return value of + hidp_send_message + +hidp_send_message was changed to return non-zero values on success, +which some other bits did not expect. This caused spurious errors to be +propagated through the stack, breaking some drivers, such as hid-sony +for the Dualshock 4 in Bluetooth mode. + +As pointed out by Dan Carpenter, hid-microsoft directly relied on that +assumption as well. + +Fixes: 48d9cc9d85dd ("Bluetooth: hidp: Let hidp_send_message return number of queued bytes") + +Signed-off-by: Dan Elkouby +Reviewed-by: Dan Carpenter +Reviewed-by: Jiri Kosina +Signed-off-by: Marcel Holtmann +--- + drivers/hid/hid-microsoft.c | 2 +- + net/bluetooth/hidp/core.c | 4 ++-- + 2 files changed, 3 insertions(+), 3 deletions(-) + +diff --git a/drivers/hid/hid-microsoft.c b/drivers/hid/hid-microsoft.c +index 8b3a922bdad3..2cf83856f2e4 100644 +--- a/drivers/hid/hid-microsoft.c ++++ b/drivers/hid/hid-microsoft.c +@@ -303,7 +303,7 @@ static void ms_ff_worker(struct work_struct *work) + r->magnitude[MAGNITUDE_WEAK] = ms->weak; /* right actuator */ + + ret = hid_hw_output_report(hdev, (__u8 *)r, sizeof(*r)); +- if (ret) ++ if (ret < 0) + hid_warn(hdev, "failed to send FF report\n"); + } + +diff --git a/net/bluetooth/hidp/core.c b/net/bluetooth/hidp/core.c +index 8d889969ae7e..bef84b95e2c4 100644 +--- a/net/bluetooth/hidp/core.c ++++ b/net/bluetooth/hidp/core.c +@@ -267,7 +267,7 @@ static int hidp_get_raw_report(struct hid_device *hid, + set_bit(HIDP_WAITING_FOR_RETURN, &session->flags); + data[0] = report_number; + ret = hidp_send_ctrl_message(session, report_type, data, 1); +- if (ret) ++ if (ret < 0) + goto err; + + /* Wait for the return of the report. The returned report +@@ -343,7 +343,7 @@ static int hidp_set_raw_report(struct hid_device *hid, unsigned char reportnum, + data[0] = reportnum; + set_bit(HIDP_WAITING_FOR_SEND_ACK, &session->flags); + ret = hidp_send_ctrl_message(session, report_type, data, count); +- if (ret) ++ if (ret < 0) + goto err; + + /* Wait for the ACK from the device. */ +-- +cgit v1.2.1-1-g437b diff --git a/60-linux.hook b/60-linux.hook index b33873c..584ce35 100644 --- a/60-linux.hook +++ b/60-linux.hook @@ -4,7 +4,6 @@ Operation = Install Operation = Upgrade Operation = Remove Target = usr/lib/modules/%KERNVER%/* -Target = usr/lib/modules/%EXTRAMODULES%/* [Action] Description = Updating %PKGBASE% module dependencies... diff --git a/PKGBUILD b/PKGBUILD index 53b40d0..061f18e 100644 --- a/PKGBUILD +++ b/PKGBUILD @@ -17,8 +17,8 @@ # Parabola version enables VMware and HyperV pkgbase=linux-libre-hardened -_majver=5.2 -_minver=18 +_majver=5.3 +_minver=7 if [ "$_minver" == "0" ]; then _pkgver=${_majver} else @@ -30,7 +30,7 @@ _hardenedver=a _gccpatchver='20190822' _srcname=linux-${_majver} pkgver=${_pkgver}.${_hardenedver} -pkgrel=2 +pkgrel=1 url='https://github.com/anthraxx/linux-hardened' arch=('x86_64') license=('GPL2') @@ -42,6 +42,7 @@ options=('!strip') source=( https://linux-libre.fsfla.org/pub/linux-libre/releases/${_gnumajver}/linux-libre-${_gnumajver}.tar.xz{,.sign} https://linux-libre.fsfla.org/pub/linux-libre/releases/${_gnupkgver}/patch-${_gnumajver}-${_gnupkgver}.xz{,.sign} + 0002-Bluetooth-hidp-Fix-assumptions-on-the-return-value-of-hidp_send_message.patch https://github.com/anthraxx/linux-hardened/releases/download/${pkgver}/linux-hardened-${pkgver}.patch{,.sig} graysky_bdver2-hotfix.patch kernel_gcc_patch-${_gccpatchver}.tar.gz::https://github.com/graysky2/kernel_gcc_patch/archive/${_gccpatchver}.tar.gz @@ -52,18 +53,19 @@ source=( 90-linux.hook # pacman hook for initramfs regeneration linux.preset # standard config files for mkinitcpio ramdisk ) -sha256sums=('abbf0a5cacc1031e55f181f61b3c417bd3a37d0960f7596cbcae6ee1b96439e9' +sha256sums=('c50879645e8f13a6a39a86748a8cd259b4ecd2191c88ef772b4432c993820c0a' 'SKIP' - 'c081eeb0a20cce80f88e4e222da9d50615fe479216b2c5f6dcafaed00d0d940d' + '62a46a51f2f09ba0fa7f02ff812044542c3cb4fb169e2c66e91a614025b5606c' 'SKIP' - '90609ea1ea62c97cfe2fd16fa5bb6ce680c571cab90e001133487d539656980c' + '9b92add42581aeb427a0c2cffc584815f0e4223a1a6bc27802ccd77eaf6e4bec' + '40f9fccc1fb9d9db2a216caf33362c861d701d3ea186488638b4ce95f8865d3f' 'SKIP' 'c5405139aa0a90a6f68f6a13e066a2bd0600c970f9f525cd3aa114b044a7f73b' '8c11086809864b5cef7d079f930bd40da8d0869c091965fa62e95de9a0fe13b5' 'e7ebf050c22bcec0028c0b3c79fd6d3913b0370ecc6a23dfe78ce475630cf503' '0f81d6e4158b7beeb0eb514f1b9401f7e23699cb0f7b0d513e25dae1815daaeb' - 'f414e3e30fb8ea3e54094cbf02cc4a893d3ea4c93002568caa96964a4f131a7d' - 'ae2e95db94ef7176207c690224169594d49445e04249d2499e9d2fbc117a0b21' + '5c44517393c5cffec39a6870dc01088b7a77cf46e94283f26715b12dc83ee0a8' + '452b8d4d71e1565ca91b1bebb280693549222ef51c47ba8964e411b2d461699c' '75f99f5239e03238f88d1a834c50043ec32b1dc568f2cc291b07d04718483919' 'ad6344badc91ad0630caacde83f7f9b97276f80d26a20619a87952be65492c65') validpgpkeys=( @@ -83,8 +85,11 @@ prepare() { patch -Np1 < ../patch-${_gnumajver}-${_gnupkgver} fi + # Hotfixes -# msg2 "Applying hotfixes" + msg2 "Applying hotfixes" + patch -p1 -i ../0002-Bluetooth-hidp-Fix-assumptions-on-the-return-value-of-hidp_send_message.patch + # linux hardened patch msg2 "Applying hardened patch" @@ -133,7 +138,7 @@ prepare() { sed -i '/SUBLEVEL = 0/d' Makefile fi - make -s kernelrelease > ../version + make -s kernelrelease > version # workaround for make -s kernelrelease not applying # localversion to version when changed using menuconfig @@ -143,13 +148,13 @@ prepare() { cat "localversion.10-pkgrel" >> ../version.temp cat "localversion.20-pkgname" >> ../version.temp cat ../localversion >> ../version.temp - cat ../version.temp | tr -d "\n" > ../version + cat ../version.temp | tr -d "\n" > version # back up the config # msg2 "Backing up config..." # cp .config ${SRCDEST}/config.libre-hardened.previous - msg2 "Prepared %s version %s" "$pkgbase" "$(<../version)" + msg2 "Prepared %s version %s" "$pkgbase" "$(