]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
3.10-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 12 Nov 2014 00:18:07 +0000 (09:18 +0900)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 12 Nov 2014 00:18:07 +0000 (09:18 +0900)
added patches:
i2c-at91-don-t-account-as-iowait.patch
sysfs-driver-core-fix-glue-dir-race-condition-by-gdp_mutex.patch

queue-3.10/i2c-at91-don-t-account-as-iowait.patch [new file with mode: 0644]
queue-3.10/series
queue-3.10/sysfs-driver-core-fix-glue-dir-race-condition-by-gdp_mutex.patch [new file with mode: 0644]

diff --git a/queue-3.10/i2c-at91-don-t-account-as-iowait.patch b/queue-3.10/i2c-at91-don-t-account-as-iowait.patch
new file mode 100644 (file)
index 0000000..65ec863
--- /dev/null
@@ -0,0 +1,32 @@
+From 11cfbfb098b22d3e57f1f2be217cad20e2d48463 Mon Sep 17 00:00:00 2001
+From: Wolfram Sang <wsa@the-dreams.de>
+Date: Mon, 3 Nov 2014 21:16:16 +0100
+Subject: i2c: at91: don't account as iowait
+
+From: Wolfram Sang <wsa@the-dreams.de>
+
+commit 11cfbfb098b22d3e57f1f2be217cad20e2d48463 upstream.
+
+iowait is for blkio [1]. I2C shouldn't use it.
+
+[1] https://lkml.org/lkml/2014/11/3/317
+
+Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
+Acked-by: Ludovic Desroches <ludovic.desroches@atmel.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/i2c/busses/i2c-at91.c |    2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/drivers/i2c/busses/i2c-at91.c
++++ b/drivers/i2c/busses/i2c-at91.c
+@@ -435,7 +435,7 @@ static int at91_do_twi_transfer(struct a
+               }
+       }
+-      ret = wait_for_completion_io_timeout(&dev->cmd_complete,
++      ret = wait_for_completion_timeout(&dev->cmd_complete,
+                                            dev->adapter.timeout);
+       if (ret == 0) {
+               dev_err(dev->dev, "controller timed out\n");
index 42c1b7b818b767e3e30b75b77f957faaea6a0e97..ecafe33c0c9bf483c361d91d5ad11eaf7f666064 100644 (file)
@@ -116,3 +116,5 @@ usb-gadget-udc-core-fix-kernel-oops-with-soft-connect.patch
 drm-radeon-remove-invalid-pci-id.patch
 rbd-fix-error-recovery-in-rbd_obj_read_sync.patch
 acer-wmi-add-acpi_backlight-video-quirk-for-the-acer-kav80.patch
+i2c-at91-don-t-account-as-iowait.patch
+sysfs-driver-core-fix-glue-dir-race-condition-by-gdp_mutex.patch
diff --git a/queue-3.10/sysfs-driver-core-fix-glue-dir-race-condition-by-gdp_mutex.patch b/queue-3.10/sysfs-driver-core-fix-glue-dir-race-condition-by-gdp_mutex.patch
new file mode 100644 (file)
index 0000000..649b3cc
--- /dev/null
@@ -0,0 +1,103 @@
+From e4a60d139060975eb956717e4f63ae348d4d8cc5 Mon Sep 17 00:00:00 2001
+From: Yijing Wang <wangyijing@huawei.com>
+Date: Fri, 7 Nov 2014 12:05:49 +0800
+Subject: sysfs: driver core: Fix glue dir race condition by gdp_mutex
+
+From: Yijing Wang <wangyijing@huawei.com>
+
+commit e4a60d139060975eb956717e4f63ae348d4d8cc5 upstream.
+
+There is a race condition when removing glue directory.
+It can be reproduced in following test:
+
+path 1: Add first child device
+device_add()
+    get_device_parent()
+            /*find parent from glue_dirs.list*/
+            list_for_each_entry(k, &dev->class->p->glue_dirs.list, entry)
+                    if (k->parent == parent_kobj) {
+                            kobj = kobject_get(k);
+                            break;
+                    }
+            ....
+            class_dir_create_and_add()
+
+path2: Remove last child device under glue dir
+device_del()
+    cleanup_device_parent()
+            cleanup_glue_dir()
+                    kobject_put(glue_dir);
+
+If path2 has been called cleanup_glue_dir(), but not
+call kobject_put(glue_dir), the glue dir is still
+in parent's kset list. Meanwhile, path1 find the glue
+dir from the glue_dirs.list. Path2 may release glue dir
+before path1 call kobject_get(). So kernel will report
+the warning and bug_on.
+
+This is a "classic" problem we have of a kref in a list
+that can be found while the last instance could be removed
+at the same time.
+
+This patch reuse gdp_mutex to fix this race condition.
+
+The following calltrace is captured in kernel 3.4, but
+the latest kernel still has this bug.
+
+-----------------------------------------------------
+<4>[ 3965.441471] WARNING: at ...include/linux/kref.h:41 kobject_get+0x33/0x40()
+<4>[ 3965.441474] Hardware name: Romley
+<4>[ 3965.441475] Modules linked in: isd_iop(O) isd_xda(O)...
+...
+<4>[ 3965.441605] Call Trace:
+<4>[ 3965.441611]  [<ffffffff8103717a>] warn_slowpath_common+0x7a/0xb0
+<4>[ 3965.441615]  [<ffffffff810371c5>] warn_slowpath_null+0x15/0x20
+<4>[ 3965.441618]  [<ffffffff81215963>] kobject_get+0x33/0x40
+<4>[ 3965.441624]  [<ffffffff812d1e45>] get_device_parent.isra.11+0x135/0x1f0
+<4>[ 3965.441627]  [<ffffffff812d22d4>] device_add+0xd4/0x6d0
+<4>[ 3965.441631]  [<ffffffff812d0dbc>] ? dev_set_name+0x3c/0x40
+....
+<2>[ 3965.441912] kernel BUG at ..../fs/sysfs/group.c:65!
+<4>[ 3965.441915] invalid opcode: 0000 [#1] SMP
+...
+<4>[ 3965.686743]  [<ffffffff811a677e>] sysfs_create_group+0xe/0x10
+<4>[ 3965.686748]  [<ffffffff810cfb04>] blk_trace_init_sysfs+0x14/0x20
+<4>[ 3965.686753]  [<ffffffff811fcabb>] blk_register_queue+0x3b/0x120
+<4>[ 3965.686756]  [<ffffffff812030bc>] add_disk+0x1cc/0x490
+....
+-------------------------------------------------------
+
+Signed-off-by: Yijing Wang <wangyijing@huawei.com>
+Signed-off-by: Weng Meiling <wengmeiling.weng@huawei.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/base/core.c |    4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+--- a/drivers/base/core.c
++++ b/drivers/base/core.c
+@@ -765,12 +765,12 @@ class_dir_create_and_add(struct class *c
+       return &dir->kobj;
+ }
++static DEFINE_MUTEX(gdp_mutex);
+ static struct kobject *get_device_parent(struct device *dev,
+                                        struct device *parent)
+ {
+       if (dev->class) {
+-              static DEFINE_MUTEX(gdp_mutex);
+               struct kobject *kobj = NULL;
+               struct kobject *parent_kobj;
+               struct kobject *k;
+@@ -834,7 +834,9 @@ static void cleanup_glue_dir(struct devi
+           glue_dir->kset != &dev->class->p->glue_dirs)
+               return;
++      mutex_lock(&gdp_mutex);
+       kobject_put(glue_dir);
++      mutex_unlock(&gdp_mutex);
+ }
+ static void cleanup_device_parent(struct device *dev)