]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
4.9-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 23 Nov 2020 09:20:37 +0000 (10:20 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 23 Nov 2020 09:20:37 +0000 (10:20 +0100)
added patches:
ext4-fix-bogus-warning-in-ext4_update_dx_flag.patch
iio-accel-kxcjk1013-replace-is_smo8500_device-with-an-acpi_type-enum.patch
regulator-fix-memory-leak-with-repeated-set_machine_constraints.patch

queue-4.9/ext4-fix-bogus-warning-in-ext4_update_dx_flag.patch [new file with mode: 0644]
queue-4.9/iio-accel-kxcjk1013-replace-is_smo8500_device-with-an-acpi_type-enum.patch [new file with mode: 0644]
queue-4.9/regulator-fix-memory-leak-with-repeated-set_machine_constraints.patch [new file with mode: 0644]
queue-4.9/series

diff --git a/queue-4.9/ext4-fix-bogus-warning-in-ext4_update_dx_flag.patch b/queue-4.9/ext4-fix-bogus-warning-in-ext4_update_dx_flag.patch
new file mode 100644 (file)
index 0000000..767412b
--- /dev/null
@@ -0,0 +1,40 @@
+From f902b216501094495ff75834035656e8119c537f Mon Sep 17 00:00:00 2001
+From: Jan Kara <jack@suse.cz>
+Date: Wed, 18 Nov 2020 16:30:32 +0100
+Subject: ext4: fix bogus warning in ext4_update_dx_flag()
+
+From: Jan Kara <jack@suse.cz>
+
+commit f902b216501094495ff75834035656e8119c537f upstream.
+
+The idea of the warning in ext4_update_dx_flag() is that we should warn
+when we are clearing EXT4_INODE_INDEX on a filesystem with metadata
+checksums enabled since after clearing the flag, checksums for internal
+htree nodes will become invalid. So there's no need to warn (or actually
+do anything) when EXT4_INODE_INDEX is not set.
+
+Link: https://lore.kernel.org/r/20201118153032.17281-1-jack@suse.cz
+Fixes: 48a34311953d ("ext4: fix checksum errors with indexed dirs")
+Reported-by: Eric Biggers <ebiggers@kernel.org>
+Reviewed-by: Eric Biggers <ebiggers@google.com>
+Signed-off-by: Jan Kara <jack@suse.cz>
+Signed-off-by: Theodore Ts'o <tytso@mit.edu>
+Cc: stable@kernel.org
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ fs/ext4/ext4.h |    3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+--- a/fs/ext4/ext4.h
++++ b/fs/ext4/ext4.h
+@@ -2395,7 +2395,8 @@ int ext4_insert_dentry(struct inode *dir
+                      struct ext4_filename *fname);
+ static inline void ext4_update_dx_flag(struct inode *inode)
+ {
+-      if (!ext4_has_feature_dir_index(inode->i_sb)) {
++      if (!ext4_has_feature_dir_index(inode->i_sb) &&
++          ext4_test_inode_flag(inode, EXT4_INODE_INDEX)) {
+               /* ext4_iget() should have caught this... */
+               WARN_ON_ONCE(ext4_has_feature_metadata_csum(inode->i_sb));
+               ext4_clear_inode_flag(inode, EXT4_INODE_INDEX);
diff --git a/queue-4.9/iio-accel-kxcjk1013-replace-is_smo8500_device-with-an-acpi_type-enum.patch b/queue-4.9/iio-accel-kxcjk1013-replace-is_smo8500_device-with-an-acpi_type-enum.patch
new file mode 100644 (file)
index 0000000..9b8402a
--- /dev/null
@@ -0,0 +1,87 @@
+From 11e94f28c3de35d5ad1ac6a242a5b30f4378991a Mon Sep 17 00:00:00 2001
+From: Hans de Goede <hdegoede@redhat.com>
+Date: Tue, 10 Nov 2020 14:38:34 +0100
+Subject: iio: accel: kxcjk1013: Replace is_smo8500_device with an acpi_type enum
+
+From: Hans de Goede <hdegoede@redhat.com>
+
+commit 11e94f28c3de35d5ad1ac6a242a5b30f4378991a upstream.
+
+Replace the boolean is_smo8500_device variable with an acpi_type enum.
+
+For now this can be either ACPI_GENERIC or ACPI_SMO8500, this is a
+preparation patch for adding special handling for the KIOX010A ACPI HID,
+which will add a ACPI_KIOX010A acpi_type to the introduced enum.
+
+For stable as needed as precursor for next patch.
+
+Signed-off-by: Hans de Goede <hdegoede@redhat.com>
+Fixes: 7f6232e69539 ("iio: accel: kxcjk1013: Add KIOX010A ACPI Hardware-ID")
+Cc: <Stable@vger.kernel.org>
+Link: https://lore.kernel.org/r/20201110133835.129080-2-hdegoede@redhat.com
+Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/iio/accel/kxcjk-1013.c |   15 ++++++++++-----
+ 1 file changed, 10 insertions(+), 5 deletions(-)
+
+--- a/drivers/iio/accel/kxcjk-1013.c
++++ b/drivers/iio/accel/kxcjk-1013.c
+@@ -91,6 +91,11 @@ enum kx_chipset {
+       KX_MAX_CHIPS /* this must be last */
+ };
++enum kx_acpi_type {
++      ACPI_GENERIC,
++      ACPI_SMO8500,
++};
++
+ struct kxcjk1013_data {
+       struct i2c_client *client;
+       struct iio_trigger *dready_trig;
+@@ -107,7 +112,7 @@ struct kxcjk1013_data {
+       bool motion_trigger_on;
+       int64_t timestamp;
+       enum kx_chipset chipset;
+-      bool is_smo8500_device;
++      enum kx_acpi_type acpi_type;
+ };
+ enum kxcjk1013_axis {
+@@ -1144,7 +1149,7 @@ static irqreturn_t kxcjk1013_data_rdy_tr
+ static const char *kxcjk1013_match_acpi_device(struct device *dev,
+                                              enum kx_chipset *chipset,
+-                                             bool *is_smo8500_device)
++                                             enum kx_acpi_type *acpi_type)
+ {
+       const struct acpi_device_id *id;
+@@ -1153,7 +1158,7 @@ static const char *kxcjk1013_match_acpi_
+               return NULL;
+       if (strcmp(id->id, "SMO8500") == 0)
+-              *is_smo8500_device = true;
++              *acpi_type = ACPI_SMO8500;
+       *chipset = (enum kx_chipset)id->driver_data;
+@@ -1189,7 +1194,7 @@ static int kxcjk1013_probe(struct i2c_cl
+       } else if (ACPI_HANDLE(&client->dev)) {
+               name = kxcjk1013_match_acpi_device(&client->dev,
+                                                  &data->chipset,
+-                                                 &data->is_smo8500_device);
++                                                 &data->acpi_type);
+       } else
+               return -ENODEV;
+@@ -1207,7 +1212,7 @@ static int kxcjk1013_probe(struct i2c_cl
+       indio_dev->modes = INDIO_DIRECT_MODE;
+       indio_dev->info = &kxcjk1013_info;
+-      if (client->irq > 0 && !data->is_smo8500_device) {
++      if (client->irq > 0 && data->acpi_type != ACPI_SMO8500) {
+               ret = devm_request_threaded_irq(&client->dev, client->irq,
+                                               kxcjk1013_data_rdy_trig_poll,
+                                               kxcjk1013_event_handler,
diff --git a/queue-4.9/regulator-fix-memory-leak-with-repeated-set_machine_constraints.patch b/queue-4.9/regulator-fix-memory-leak-with-repeated-set_machine_constraints.patch
new file mode 100644 (file)
index 0000000..8995345
--- /dev/null
@@ -0,0 +1,105 @@
+From 57a6ad482af256b2a13de14194fb8f67c1a65f10 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Micha=C5=82=20Miros=C5=82aw?= <mirq-linux@rere.qmqm.pl>
+Date: Fri, 13 Nov 2020 01:20:27 +0100
+Subject: regulator: fix memory leak with repeated set_machine_constraints()
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Michał Mirosław <mirq-linux@rere.qmqm.pl>
+
+commit 57a6ad482af256b2a13de14194fb8f67c1a65f10 upstream.
+
+Fixed commit introduced a possible second call to
+set_machine_constraints() and that allocates memory for
+rdev->constraints. Move the allocation to the caller so
+it's easier to manage and done once.
+
+Fixes: aea6cb99703e ("regulator: resolve supply after creating regulator")
+Cc: stable@vger.kernel.org
+Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
+Tested-by: Ahmad Fatoum <a.fatoum@pengutronix.de> # stpmic1
+Link: https://lore.kernel.org/r/78c3d4016cebc08d441aad18cb924b4e4d9cf9df.1605226675.git.mirq-linux@rere.qmqm.pl
+Signed-off-by: Mark Brown <broonie@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/regulator/core.c |   29 +++++++++++++----------------
+ 1 file changed, 13 insertions(+), 16 deletions(-)
+
+--- a/drivers/regulator/core.c
++++ b/drivers/regulator/core.c
+@@ -1025,7 +1025,6 @@ static int _regulator_do_enable(struct r
+ /**
+  * set_machine_constraints - sets regulator constraints
+  * @rdev: regulator source
+- * @constraints: constraints to apply
+  *
+  * Allows platform initialisation code to define and constrain
+  * regulator circuits e.g. valid voltage/current ranges, etc.  NOTE:
+@@ -1033,21 +1032,11 @@ static int _regulator_do_enable(struct r
+  * regulator operations to proceed i.e. set_voltage, set_current_limit,
+  * set_mode.
+  */
+-static int set_machine_constraints(struct regulator_dev *rdev,
+-      const struct regulation_constraints *constraints)
++static int set_machine_constraints(struct regulator_dev *rdev)
+ {
+       int ret = 0;
+       const struct regulator_ops *ops = rdev->desc->ops;
+-      if (constraints)
+-              rdev->constraints = kmemdup(constraints, sizeof(*constraints),
+-                                          GFP_KERNEL);
+-      else
+-              rdev->constraints = kzalloc(sizeof(*constraints),
+-                                          GFP_KERNEL);
+-      if (!rdev->constraints)
+-              return -ENOMEM;
+-
+       ret = machine_constraints_voltage(rdev, rdev->constraints);
+       if (ret != 0)
+               return ret;
+@@ -3924,7 +3913,6 @@ struct regulator_dev *
+ regulator_register(const struct regulator_desc *regulator_desc,
+                  const struct regulator_config *cfg)
+ {
+-      const struct regulation_constraints *constraints = NULL;
+       const struct regulator_init_data *init_data;
+       struct regulator_config *config = NULL;
+       static atomic_t regulator_no = ATOMIC_INIT(-1);
+@@ -4024,14 +4012,23 @@ regulator_register(const struct regulato
+       /* set regulator constraints */
+       if (init_data)
+-              constraints = &init_data->constraints;
++              rdev->constraints = kmemdup(&init_data->constraints,
++                                          sizeof(*rdev->constraints),
++                                          GFP_KERNEL);
++      else
++              rdev->constraints = kzalloc(sizeof(*rdev->constraints),
++                                          GFP_KERNEL);
++      if (!rdev->constraints) {
++              ret = -ENOMEM;
++              goto wash;
++      }
+       if (init_data && init_data->supply_regulator)
+               rdev->supply_name = init_data->supply_regulator;
+       else if (regulator_desc->supply_name)
+               rdev->supply_name = regulator_desc->supply_name;
+-      ret = set_machine_constraints(rdev, constraints);
++      ret = set_machine_constraints(rdev);
+       if (ret == -EPROBE_DEFER) {
+               /* Regulator might be in bypass mode and so needs its supply
+                * to set the constraints */
+@@ -4040,7 +4037,7 @@ regulator_register(const struct regulato
+                * that is just being created */
+               ret = regulator_resolve_supply(rdev);
+               if (!ret)
+-                      ret = set_machine_constraints(rdev, constraints);
++                      ret = set_machine_constraints(rdev);
+               else
+                       rdev_dbg(rdev, "unable to resolve supply early: %pe\n",
+                                ERR_PTR(ret));
index 092eec9eb72d18c61265687861d775bace043da3..a9af19cf165e2827d7d2f5962a45cc4a6d788c51 100644 (file)
@@ -36,3 +36,6 @@ alsa-ctl-fix-error-path-at-adding-user-defined-element-set.patch
 alsa-mixart-fix-mutex-deadlock.patch
 tty-serial-imx-keep-console-clocks-always-on.patch
 efivarfs-fix-memory-leak-in-efivarfs_create.patch
+ext4-fix-bogus-warning-in-ext4_update_dx_flag.patch
+iio-accel-kxcjk1013-replace-is_smo8500_device-with-an-acpi_type-enum.patch
+regulator-fix-memory-leak-with-repeated-set_machine_constraints.patch