]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
4.14-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 28 Dec 2022 09:18:22 +0000 (10:18 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 28 Dec 2022 09:18:22 +0000 (10:18 +0100)
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

queue-4.14/hid-wacom-ensure-bootloader-pid-is-usable-in-hidraw-mode.patch [new file with mode: 0644]
queue-4.14/iio-adc-ad_sigma_delta-do-not-use-internal-iio_dev-lock.patch [new file with mode: 0644]
queue-4.14/reiserfs-add-missing-calls-to-reiserfs_security_free.patch [new file with mode: 0644]
queue-4.14/series

diff --git a/queue-4.14/hid-wacom-ensure-bootloader-pid-is-usable-in-hidraw-mode.patch b/queue-4.14/hid-wacom-ensure-bootloader-pid-is-usable-in-hidraw-mode.patch
new file mode 100644 (file)
index 0000000..3b80c06
--- /dev/null
@@ -0,0 +1,89 @@
+From 1db1f392591aff13fd643f0ec7c1d5e27391d700 Mon Sep 17 00:00:00 2001
+From: Jason Gerecke <killertofu@gmail.com>
+Date: Thu, 1 Dec 2022 15:11:41 -0800
+Subject: HID: wacom: Ensure bootloader PID is usable in hidraw mode
+
+From: Jason Gerecke <killertofu@gmail.com>
+
+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 <jason.gerecke@wacom.com>
+Tested-by: Tatsunosuke Tobita <tatsunosuke.tobita@wacom.com>
+Cc: <stable@vger.kernel.org>
+Signed-off-by: Jiri Kosina <jkosina@suse.cz>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ 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
+@@ -61,6 +61,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;
+@@ -2616,6 +2619,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
+@@ -4477,6 +4477,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
+@@ -4550,6 +4553,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
+@@ -237,6 +237,7 @@ enum {
+       MTTPC,
+       MTTPC_B,
+       HID_GENERIC,
++      BOOTLOADER,
+       MAX_TYPE
+ };
diff --git a/queue-4.14/iio-adc-ad_sigma_delta-do-not-use-internal-iio_dev-lock.patch b/queue-4.14/iio-adc-ad_sigma_delta-do-not-use-internal-iio_dev-lock.patch
new file mode 100644 (file)
index 0000000..161a34c
--- /dev/null
@@ -0,0 +1,54 @@
+From 20228a1d5a55e7db0c6720840f2c7d2b48c55f69 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Nuno=20S=C3=A1?= <nuno.sa@analog.com>
+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á <nuno.sa@analog.com>
+
+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á <nuno.sa@analog.com>
+Reviewed-by: Miquel Raynal <miquel.raynal@bootlin.com>
+Cc: <Stable@vger.kernel.org> #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 <Jonathan.Cameron@huawei.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ 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.14/reiserfs-add-missing-calls-to-reiserfs_security_free.patch b/queue-4.14/reiserfs-add-missing-calls-to-reiserfs_security_free.patch
new file mode 100644 (file)
index 0000000..aa48b3d
--- /dev/null
@@ -0,0 +1,89 @@
+From 572302af1258459e124437b8f3369357447afac7 Mon Sep 17 00:00:00 2001
+From: Roberto Sassu <roberto.sassu@huawei.com>
+Date: Thu, 10 Nov 2022 10:46:35 +0100
+Subject: reiserfs: Add missing calls to reiserfs_security_free()
+
+From: Roberto Sassu <roberto.sassu@huawei.com>
+
+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 <jeffm@suse.com>
+Cc: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
+Reported-by: Mimi Zohar <zohar@linux.ibm.com>
+Reported-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
+Signed-off-by: Roberto Sassu <roberto.sassu@huawei.com>
+Reviewed-by: Mimi Zohar <zohar@linux.ibm.com>
+Signed-off-by: Paul Moore <paul@paul-moore.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ 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
+@@ -49,6 +49,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))
+@@ -94,7 +95,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;
index d95882e64ae9e5599f3190e7048ea5b870f362b0..9e74bc011a94e5b59f677d72aa8a76fea1f63ff8 100644 (file)
@@ -257,3 +257,6 @@ asoc-rt5670-remove-unbalanced-pm_runtime_put.patch
 pstore-switch-pmsg_lock-to-an-rt_mutex-to-avoid-prio.patch
 pstore-make-sure-config_pstore_pmsg-selects-config_r.patch
 usb-dwc3-core-defer-probe-on-ulpi_read_id-timeout.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