From 80307071253c844d128e73cb0cb365cc3c1c401b Mon Sep 17 00:00:00 2001 From: jc_gargma Date: Sun, 24 Jan 2021 03:51:23 -0800 Subject: Updated to 5.10.10 Many versioning fixes --- ...ect-NULL-dereference-on-AES-pen-proximity.patch | 76 ++++++++++++++++++++++ PKGBUILD | 36 +++++----- 2 files changed, 96 insertions(+), 16 deletions(-) create mode 100644 0004-HID-wacom-Correct-NULL-dereference-on-AES-pen-proximity.patch diff --git a/0004-HID-wacom-Correct-NULL-dereference-on-AES-pen-proximity.patch b/0004-HID-wacom-Correct-NULL-dereference-on-AES-pen-proximity.patch new file mode 100644 index 0000000..0de03e8 --- /dev/null +++ b/0004-HID-wacom-Correct-NULL-dereference-on-AES-pen-proximity.patch @@ -0,0 +1,76 @@ +From 85c0c0e3a81f87290db5e881af609d51021b54b7 Mon Sep 17 00:00:00 2001 +From: Jason Gerecke +Date: Thu, 21 Jan 2021 10:46:49 -0800 +Subject: HID: wacom: Correct NULL dereference on AES pen proximity + +The recent commit to fix a memory leak introduced an inadvertant NULL +pointer dereference. The `wacom_wac->pen_fifo` variable was never +intialized, resuling in a crash whenever functions tried to use it. +Since the FIFO is only used by AES pens (to buffer events from pen +proximity until the hardware reports the pen serial number) this would +have been easily overlooked without testing an AES device. + +This patch converts `wacom_wac->pen_fifo` over to a pointer (since the +call to `devres_alloc` allocates memory for us) and ensures that we assign +it to point to the allocated and initalized `pen_fifo` before the function +returns. + +Link: https://github.com/linuxwacom/input-wacom/issues/230 +Fixes: 37309f47e2f5 ("HID: wacom: Fix memory leakage caused by kfifo_alloc") +CC: stable@vger.kernel.org # v4.19+ +Signed-off-by: Jason Gerecke +Tested-by: Ping Cheng +--- + drivers/hid/wacom_sys.c | 7 ++++--- + drivers/hid/wacom_wac.h | 2 +- + 2 files changed, 5 insertions(+), 4 deletions(-) + +diff --git a/drivers/hid/wacom_sys.c b/drivers/hid/wacom_sys.c +index 9e852b4bbf92..73dafa60080f 100644 +--- a/drivers/hid/wacom_sys.c ++++ b/drivers/hid/wacom_sys.c +@@ -147,9 +147,9 @@ static int wacom_wac_pen_serial_enforce(struct hid_device *hdev, + } + + if (flush) +- wacom_wac_queue_flush(hdev, &wacom_wac->pen_fifo); ++ wacom_wac_queue_flush(hdev, wacom_wac->pen_fifo); + else if (insert) +- wacom_wac_queue_insert(hdev, &wacom_wac->pen_fifo, ++ wacom_wac_queue_insert(hdev, wacom_wac->pen_fifo, + raw_data, report_size); + + return insert && !flush; +@@ -1280,7 +1280,7 @@ static void wacom_devm_kfifo_release(struct device *dev, void *res) + static int wacom_devm_kfifo_alloc(struct wacom *wacom) + { + struct wacom_wac *wacom_wac = &wacom->wacom_wac; +- struct kfifo_rec_ptr_2 *pen_fifo = &wacom_wac->pen_fifo; ++ struct kfifo_rec_ptr_2 *pen_fifo; + int error; + + pen_fifo = devres_alloc(wacom_devm_kfifo_release, +@@ -1297,6 +1297,7 @@ static int wacom_devm_kfifo_alloc(struct wacom *wacom) + } + + devres_add(&wacom->hdev->dev, pen_fifo); ++ wacom_wac->pen_fifo = pen_fifo; + + return 0; + } +diff --git a/drivers/hid/wacom_wac.h b/drivers/hid/wacom_wac.h +index da612b6e9c77..195910dd2154 100644 +--- a/drivers/hid/wacom_wac.h ++++ b/drivers/hid/wacom_wac.h +@@ -342,7 +342,7 @@ struct wacom_wac { + struct input_dev *pen_input; + struct input_dev *touch_input; + struct input_dev *pad_input; +- struct kfifo_rec_ptr_2 pen_fifo; ++ struct kfifo_rec_ptr_2 *pen_fifo; + int pid; + int num_contacts_left; + u8 bt_features; +-- +cgit v1.2.3-1-gf6bb5 + diff --git a/PKGBUILD b/PKGBUILD index 6921693..e7cd979 100644 --- a/PKGBUILD +++ b/PKGBUILD @@ -20,17 +20,16 @@ _pkgbase=linux-hardened pkgbase=linux-libre-hardened _supver=5 _majver=10 -_minver=9 -_hardenedver=a +_minver=10 _gccpatchver='20201113' _gccpatchger='10.1' _gccpatchker='5.8' +_hardenedver=hardened1 if [ "$_minver" == "0" ]; then - _pkgver=${_supver}.${_majver} + pkgver=${_supver}.${_majver} else - _pkgver=${_supver}.${_majver}.${_minver} + pkgver=${_supver}.${_majver}.${_minver} fi -pkgver=${_pkgver}.${_hardenedver} pkgrel=1 pkgdesc='Security-Hardened Linux-libre' url='https://github.com/anthraxx/linux-hardened' @@ -45,13 +44,14 @@ conflicts=('linux-hardened') options=('!strip') _srcname=linux-${_supver}.${_majver} _gnumajver=${_supver}.${_majver}-gnu -_gnupkgver=${_pkgver}-gnu +_gnupkgver=${pkgver}-gnu source=( https://linux-libre.fsfla.org/pub/linux-libre/releases/${_gnumajver}/linux-libre-${_gnumajver}.tar.xz{,.sign} - https://github.com/anthraxx/${_pkgbase}/releases/download/${pkgver}/${_pkgbase}-${pkgver}.patch{,.sig} + https://github.com/anthraxx/${_pkgbase}/releases/download/${pkgver}-${_hardenedver}/${_pkgbase}-${pkgver}-${_hardenedver}.patch{,.sig} config # the main kernel config file 0002-HID-quirks-Add-Apple-Magic-Trackpad-2-to-hid_have_special_driver-list.patch 0003-iwlwifi-Fix-regression-from-UDP-segmentation-support.patch + 0004-HID-wacom-Correct-NULL-dereference-on-AES-pen-proximity.patch kernel_gcc_patch-${_gccpatchver}.tar.gz::https://github.com/graysky2/kernel_gcc_patch/archive/${_gccpatchver}.tar.gz ath9k-regdom-hack.patch raid6-default-algo.patch @@ -65,15 +65,16 @@ validpgpkeys=( ) b2sums=('86103699a6bc906e85429430df098b0ddb7cfc8c887f98b37f994498388d634554e119eadb1b15f591bdf4f463e7efb7420e3e370af0029b7ed9e988a5f26b01' 'SKIP' - 'f34dd05bec5b219929fbb434d594a20f39c4aae83064e9b7c8d968dd2d6d70c93259e82c4e1e492f8bae5c17d505dc19809ad6e7375048ac71ae6a1c60583e47' + '2fcab5e28db7c1c2d2464eb0544733d8800f3e92dbc2392e89b7f293d014c67282269905559366c883b3b450016ea727fcea2835c3a86b6faf0c0fb072246ebc' 'SKIP' '970534b4740805ec543d6e5471044947b751e64ebdf22ea8f7cc4ac0dfa147745d73040c6ca27a8e113f1eef18fa1be1482d5784358fd9c272019c1778b76f0b' 'd8297e09f552a2d6bb24c2ba10481fd2b407057f3b24278e72a89233473460d339c83838791989773623178b5af80588fb4c484da2931f1040e313cce7ceca00' '15d9b32ff1ad4c897b097173de259cdb89bbbf6ab0230faf4557eca511a59c1f2c76b85be30d25cf9534f91e1af43e72d072bc82dbf2219eadf772822f573d38' + '078dca48f0937ad021b1d50ba98dc1c156fb67a18b25fa079d2d35d0aa5480fb820e952c7f569cff5744cd32976a23942c2e822d1cfada8144e9a8dc9bae1d82' '7f1eb5938472f57748216bd00e0c875feab99fc1c5cb89babfea467ee30ca5c8e9fc5a691efe2e602bef1ea79820c5383822d7cec354b48d23321ccda8ee8127' 'b6ef77035611139fa9a6d5b8d30570e2781bb4da483bb569884b0bd0129b62e0b82a5a6776fefe43fee801c70d39de1ea4d4c177f7cedd5ac135e3c64f7b895a' 'fde132f3705d908e6f2147c78a2193289916d72304ca5efa2229d79fc3e57a857314ce94e71425caef2f7f7b6cf87f05ef86335dc8bd4be78e7035afe608005a' - 'f90bc3a6db58fcfac2e8de4b3917a751f19d91c285678c8dc33842645cf43fb7333c3670a52bab13555527853aac80867505322556d5816c483b1398a9f0fbb6' + '1bca51f51972850011d25d123cb6333ebb151a5673f643d41aa9ee4050ccccf9d7fbdf3caa185dff70f74ed468cb402a1bda370b82668889a0abbf278acfbcea' 'SKIP') export KBUILD_BUILD_HOST=arc4linux @@ -89,19 +90,23 @@ prepare() { patch -Np1 < ../patch-${_gnumajver}-${_gnupkgver} fi + # Remove the -gnu EXTRAVERSION + sed -e "/^EXTRAVERSION =/s/= -gnu/= /" -i Makefile + # Hotfixes echo "Applying hotfixes" patch -p1 -i ../0002-HID-quirks-Add-Apple-Magic-Trackpad-2-to-hid_have_special_driver-list.patch patch -p1 -i ../0003-iwlwifi-Fix-regression-from-UDP-segmentation-support.patch + patch -p1 -i ../0004-HID-wacom-Correct-NULL-dereference-on-AES-pen-proximity.patch - # Work around hardened not applying to linux-libre - sed -e "/^EXTRAVERSION =/s/=.*/=/" -i Makefile - # linux hardened patch echo "Applying hardened patch" - patch -Np1 < ../linux-hardened-${pkgver}.patch + patch -Np1 < ../linux-hardened-${pkgver}-${_hardenedver}.patch + + # Remove the -hardened EXTRAVERSION + sed -e "/^EXTRAVERSION =/s/= -${_hardenedver}/= /" -i Makefile # graysky gcc patch @@ -118,8 +123,8 @@ prepare() { patch -p1 -i ../raid6-default-algo.patch + # Append pkgrel and patchset suffixes echo "Setting version..." - sed -e "/^EXTRAVERSION =/s/=.*/= .${_hardenedver}/" -i Makefile scripts/setlocalversion --save-scmversion echo "-$pkgrel" > localversion.10-pkgrel echo "${pkgbase#linux}" > localversion.20-pkgname @@ -147,8 +152,7 @@ prepare() { # workaround for make -s kernelrelease not applying # localversion to version when changed using menuconfig grep -Po '(?<=CONFIG_LOCALVERSION=").*(?=")' .config > ../localversion - echo "$_pkgver" > ../version.temp - echo ".$_hardenedver" >> ../version.temp + echo "$pkgver" > ../version.temp cat "localversion.10-pkgrel" >> ../version.temp cat "localversion.20-pkgname" >> ../version.temp cat ../localversion >> ../version.temp -- cgit v1.2.1