From ac2029570bf1e8a38073ec3afa9674dfe6095dda Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Wed, 28 Dec 2022 10:18:10 +0100 Subject: [PATCH] 4.9-stable patches added patches: hid-wacom-ensure-bootloader-pid-is-usable-in-hidraw-mode.patch iio-adc-ad_sigma_delta-do-not-use-internal-iio_dev-lock.patch reiserfs-add-missing-calls-to-reiserfs_security_free.patch --- ...670-remove-unbalanced-pm_runtime_put.patch | 9 +- ...tloader-pid-is-usable-in-hidraw-mode.patch | 89 +++++++++++++++++++ ...lta-do-not-use-internal-iio_dev-lock.patch | 54 +++++++++++ ...sing-calls-to-reiserfs_security_free.patch | 89 +++++++++++++++++++ queue-4.9/series | 3 + 5 files changed, 237 insertions(+), 7 deletions(-) create mode 100644 queue-4.9/hid-wacom-ensure-bootloader-pid-is-usable-in-hidraw-mode.patch create mode 100644 queue-4.9/iio-adc-ad_sigma_delta-do-not-use-internal-iio_dev-lock.patch create mode 100644 queue-4.9/reiserfs-add-missing-calls-to-reiserfs_security_free.patch diff --git a/queue-4.9/asoc-rt5670-remove-unbalanced-pm_runtime_put.patch b/queue-4.9/asoc-rt5670-remove-unbalanced-pm_runtime_put.patch index 61ccc3494e7..cc74b32238d 100644 --- a/queue-4.9/asoc-rt5670-remove-unbalanced-pm_runtime_put.patch +++ b/queue-4.9/asoc-rt5670-remove-unbalanced-pm_runtime_put.patch @@ -21,14 +21,12 @@ Link: https://lore.kernel.org/r/20221213123319.11285-1-hdegoede@redhat.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- - sound/soc/codecs/rt5670.c | 2 -- + sound/soc/codecs/rt5670.c | 2 -- 1 file changed, 2 deletions(-) -diff --git a/sound/soc/codecs/rt5670.c b/sound/soc/codecs/rt5670.c -index fdc14e50d3b9..13b944bcde71 100644 --- a/sound/soc/codecs/rt5670.c +++ b/sound/soc/codecs/rt5670.c -@@ -3028,8 +3028,6 @@ static int rt5670_i2c_probe(struct i2c_client *i2c, +@@ -3028,8 +3028,6 @@ static int rt5670_i2c_probe(struct i2c_c if (ret < 0) goto err; @@ -37,6 +35,3 @@ index fdc14e50d3b9..13b944bcde71 100644 return 0; err: pm_runtime_disable(&i2c->dev); --- -2.35.1 - diff --git a/queue-4.9/hid-wacom-ensure-bootloader-pid-is-usable-in-hidraw-mode.patch b/queue-4.9/hid-wacom-ensure-bootloader-pid-is-usable-in-hidraw-mode.patch new file mode 100644 index 00000000000..096fd3b785c --- /dev/null +++ b/queue-4.9/hid-wacom-ensure-bootloader-pid-is-usable-in-hidraw-mode.patch @@ -0,0 +1,89 @@ +From 1db1f392591aff13fd643f0ec7c1d5e27391d700 Mon Sep 17 00:00:00 2001 +From: Jason Gerecke +Date: Thu, 1 Dec 2022 15:11:41 -0800 +Subject: HID: wacom: Ensure bootloader PID is usable in hidraw mode + +From: Jason Gerecke + +commit 1db1f392591aff13fd643f0ec7c1d5e27391d700 upstream. + +Some Wacom devices have a special "bootloader" mode that is used for +firmware flashing. When operating in this mode, the device cannot be +used for input, and the HID descriptor is not able to be processed by +the driver. The driver generates an "Unknown device_type" warning and +then returns an error code from wacom_probe(). This is a problem because +userspace still needs to be able to interact with the device via hidraw +to perform the firmware flash. + +This commit adds a non-generic device definition for 056a:0094 which +is used when devices are in "bootloader" mode. It marks the devices +with a special BOOTLOADER type that is recognized by wacom_probe() and +wacom_raw_event(). When we see this type we ensure a hidraw device is +created and otherwise keep our hands off so that userspace is in full +control. + +Signed-off-by: Jason Gerecke +Tested-by: Tatsunosuke Tobita +Cc: +Signed-off-by: Jiri Kosina +Signed-off-by: Greg Kroah-Hartman +--- + drivers/hid/wacom_sys.c | 8 ++++++++ + drivers/hid/wacom_wac.c | 4 ++++ + drivers/hid/wacom_wac.h | 1 + + 3 files changed, 13 insertions(+) + +--- a/drivers/hid/wacom_sys.c ++++ b/drivers/hid/wacom_sys.c +@@ -69,6 +69,9 @@ static int wacom_raw_event(struct hid_de + { + struct wacom *wacom = hid_get_drvdata(hdev); + ++ if (wacom->wacom_wac.features.type == BOOTLOADER) ++ return 0; ++ + if (size > WACOM_PKGLEN_MAX) + return 1; + +@@ -2409,6 +2412,11 @@ static int wacom_probe(struct hid_device + goto fail; + } + ++ if (features->type == BOOTLOADER) { ++ hid_warn(hdev, "Using device in hidraw-only mode"); ++ return hid_hw_start(hdev, HID_CONNECT_HIDRAW); ++ } ++ + error = wacom_parse_and_register(wacom, false); + if (error) + goto fail; +--- a/drivers/hid/wacom_wac.c ++++ b/drivers/hid/wacom_wac.c +@@ -3550,6 +3550,9 @@ static const struct wacom_features wacom + static const struct wacom_features wacom_features_HID_ANY_ID = + { "Wacom HID", .type = HID_GENERIC, .oVid = HID_ANY_ID, .oPid = HID_ANY_ID }; + ++static const struct wacom_features wacom_features_0x94 = ++ { "Wacom Bootloader", .type = BOOTLOADER }; ++ + #define USB_DEVICE_WACOM(prod) \ + HID_DEVICE(BUS_USB, HID_GROUP_WACOM, USB_VENDOR_ID_WACOM, prod),\ + .driver_data = (kernel_ulong_t)&wacom_features_##prod +@@ -3623,6 +3626,7 @@ const struct hid_device_id wacom_ids[] = + { USB_DEVICE_WACOM(0x84) }, + { USB_DEVICE_WACOM(0x90) }, + { USB_DEVICE_WACOM(0x93) }, ++ { USB_DEVICE_WACOM(0x94) }, + { USB_DEVICE_WACOM(0x97) }, + { USB_DEVICE_WACOM(0x9A) }, + { USB_DEVICE_WACOM(0x9F) }, +--- a/drivers/hid/wacom_wac.h ++++ b/drivers/hid/wacom_wac.h +@@ -154,6 +154,7 @@ enum { + MTTPC, + MTTPC_B, + HID_GENERIC, ++ BOOTLOADER, + MAX_TYPE + }; + diff --git a/queue-4.9/iio-adc-ad_sigma_delta-do-not-use-internal-iio_dev-lock.patch b/queue-4.9/iio-adc-ad_sigma_delta-do-not-use-internal-iio_dev-lock.patch new file mode 100644 index 00000000000..161a34c34ca --- /dev/null +++ b/queue-4.9/iio-adc-ad_sigma_delta-do-not-use-internal-iio_dev-lock.patch @@ -0,0 +1,54 @@ +From 20228a1d5a55e7db0c6720840f2c7d2b48c55f69 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Nuno=20S=C3=A1?= +Date: Tue, 20 Sep 2022 13:28:07 +0200 +Subject: iio: adc: ad_sigma_delta: do not use internal iio_dev lock +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Nuno Sá + +commit 20228a1d5a55e7db0c6720840f2c7d2b48c55f69 upstream. + +Drop 'mlock' usage by making use of iio_device_claim_direct_mode(). +This change actually makes sure we cannot do a single conversion while +buffering is enable. Note there was a potential race in the previous +code since we were only acquiring the lock after checking if the bus is +enabled. + +Fixes: af3008485ea0 ("iio:adc: Add common code for ADI Sigma Delta devices") +Signed-off-by: Nuno Sá +Reviewed-by: Miquel Raynal +Cc: #No rush as race is very old. +Link: https://lore.kernel.org/r/20220920112821.975359-2-nuno.sa@analog.com +Signed-off-by: Jonathan Cameron +Signed-off-by: Greg Kroah-Hartman +--- + drivers/iio/adc/ad_sigma_delta.c | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +--- a/drivers/iio/adc/ad_sigma_delta.c ++++ b/drivers/iio/adc/ad_sigma_delta.c +@@ -282,10 +282,10 @@ int ad_sigma_delta_single_conversion(str + unsigned int sample, raw_sample; + int ret = 0; + +- if (iio_buffer_enabled(indio_dev)) +- return -EBUSY; ++ ret = iio_device_claim_direct_mode(indio_dev); ++ if (ret) ++ return ret; + +- mutex_lock(&indio_dev->mlock); + ad_sigma_delta_set_channel(sigma_delta, chan->address); + + spi_bus_lock(sigma_delta->spi->master); +@@ -319,7 +319,7 @@ out: + ad_sigma_delta_set_mode(sigma_delta, AD_SD_MODE_IDLE); + sigma_delta->bus_locked = false; + spi_bus_unlock(sigma_delta->spi->master); +- mutex_unlock(&indio_dev->mlock); ++ iio_device_release_direct_mode(indio_dev); + + if (ret) + return ret; diff --git a/queue-4.9/reiserfs-add-missing-calls-to-reiserfs_security_free.patch b/queue-4.9/reiserfs-add-missing-calls-to-reiserfs_security_free.patch new file mode 100644 index 00000000000..148bc866312 --- /dev/null +++ b/queue-4.9/reiserfs-add-missing-calls-to-reiserfs_security_free.patch @@ -0,0 +1,89 @@ +From 572302af1258459e124437b8f3369357447afac7 Mon Sep 17 00:00:00 2001 +From: Roberto Sassu +Date: Thu, 10 Nov 2022 10:46:35 +0100 +Subject: reiserfs: Add missing calls to reiserfs_security_free() + +From: Roberto Sassu + +commit 572302af1258459e124437b8f3369357447afac7 upstream. + +Commit 57fe60df6241 ("reiserfs: add atomic addition of selinux attributes +during inode creation") defined reiserfs_security_free() to free the name +and value of a security xattr allocated by the active LSM through +security_old_inode_init_security(). However, this function is not called +in the reiserfs code. + +Thus, add a call to reiserfs_security_free() whenever +reiserfs_security_init() is called, and initialize value to NULL, to avoid +to call kfree() on an uninitialized pointer. + +Finally, remove the kfree() for the xattr name, as it is not allocated +anymore. + +Fixes: 57fe60df6241 ("reiserfs: add atomic addition of selinux attributes during inode creation") +Cc: stable@vger.kernel.org +Cc: Jeff Mahoney +Cc: Tetsuo Handa +Reported-by: Mimi Zohar +Reported-by: Tetsuo Handa +Signed-off-by: Roberto Sassu +Reviewed-by: Mimi Zohar +Signed-off-by: Paul Moore +Signed-off-by: Greg Kroah-Hartman +--- + fs/reiserfs/namei.c | 4 ++++ + fs/reiserfs/xattr_security.c | 2 +- + 2 files changed, 5 insertions(+), 1 deletion(-) + +--- a/fs/reiserfs/namei.c ++++ b/fs/reiserfs/namei.c +@@ -695,6 +695,7 @@ static int reiserfs_create(struct inode + + out_failed: + reiserfs_write_unlock(dir->i_sb); ++ reiserfs_security_free(&security); + return retval; + } + +@@ -778,6 +779,7 @@ static int reiserfs_mknod(struct inode * + + out_failed: + reiserfs_write_unlock(dir->i_sb); ++ reiserfs_security_free(&security); + return retval; + } + +@@ -876,6 +878,7 @@ static int reiserfs_mkdir(struct inode * + retval = journal_end(&th); + out_failed: + reiserfs_write_unlock(dir->i_sb); ++ reiserfs_security_free(&security); + return retval; + } + +@@ -1191,6 +1194,7 @@ static int reiserfs_symlink(struct inode + retval = journal_end(&th); + out_failed: + reiserfs_write_unlock(parent_dir->i_sb); ++ reiserfs_security_free(&security); + return retval; + } + +--- a/fs/reiserfs/xattr_security.c ++++ b/fs/reiserfs/xattr_security.c +@@ -48,6 +48,7 @@ int reiserfs_security_init(struct inode + int error; + + sec->name = NULL; ++ sec->value = NULL; + + /* Don't add selinux attributes on xattrs - they'll never get used */ + if (IS_PRIVATE(dir)) +@@ -93,7 +94,6 @@ int reiserfs_security_write(struct reise + + void reiserfs_security_free(struct reiserfs_security_handle *sec) + { +- kfree(sec->name); + kfree(sec->value); + sec->name = NULL; + sec->value = NULL; diff --git a/queue-4.9/series b/queue-4.9/series index 10846de53a9..ce83f2656c7 100644 --- a/queue-4.9/series +++ b/queue-4.9/series @@ -213,3 +213,6 @@ asoc-mediatek-mt8173-rt5650-rt5514-fix-refcount-leak.patch asoc-wm8994-fix-potential-deadlock.patch asoc-rockchip-spdif-add-missing-clk_disable_unprepar.patch asoc-rt5670-remove-unbalanced-pm_runtime_put.patch +hid-wacom-ensure-bootloader-pid-is-usable-in-hidraw-mode.patch +reiserfs-add-missing-calls-to-reiserfs_security_free.patch +iio-adc-ad_sigma_delta-do-not-use-internal-iio_dev-lock.patch -- 2.47.3