]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
3.0-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 21 Sep 2012 17:57:25 +0000 (10:57 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 21 Sep 2012 17:57:25 +0000 (10:57 -0700)
added patches:
ahci-add-alternate-identifier-for-the-88se9172.patch
fs-proc-fix-potential-unregister_sysctl_table-hang.patch
kobject-fix-oops-with-input0-bad-kobj_uevent_env-content-in-show_uevent.patch
mmc-mxs-mmc-fix-deadlock-in-sdio-irq-case.patch
mmc-sdhci-esdhc-break-out-early-if-clock-is-0.patch
perf_event-switch-to-internal-refcount-fix-race-with-close.patch
redefine-atomic_init-and-atomic64_init-to-drop-the-casts.patch

queue-3.0/ahci-add-alternate-identifier-for-the-88se9172.patch [new file with mode: 0644]
queue-3.0/fs-proc-fix-potential-unregister_sysctl_table-hang.patch [new file with mode: 0644]
queue-3.0/kobject-fix-oops-with-input0-bad-kobj_uevent_env-content-in-show_uevent.patch [new file with mode: 0644]
queue-3.0/mmc-mxs-mmc-fix-deadlock-in-sdio-irq-case.patch [new file with mode: 0644]
queue-3.0/mmc-sdhci-esdhc-break-out-early-if-clock-is-0.patch [new file with mode: 0644]
queue-3.0/perf_event-switch-to-internal-refcount-fix-race-with-close.patch [new file with mode: 0644]
queue-3.0/redefine-atomic_init-and-atomic64_init-to-drop-the-casts.patch [new file with mode: 0644]
queue-3.0/series

diff --git a/queue-3.0/ahci-add-alternate-identifier-for-the-88se9172.patch b/queue-3.0/ahci-add-alternate-identifier-for-the-88se9172.patch
new file mode 100644 (file)
index 0000000..be7ac90
--- /dev/null
@@ -0,0 +1,32 @@
+From 17c60c6b763cb5b83b0185e7d38d01d18e55a05a Mon Sep 17 00:00:00 2001
+From: Alan Cox <alan@linux.intel.com>
+Date: Tue, 4 Sep 2012 16:07:18 +0100
+Subject: ahci: Add alternate identifier for the 88SE9172
+
+From: Alan Cox <alan@linux.intel.com>
+
+commit 17c60c6b763cb5b83b0185e7d38d01d18e55a05a upstream.
+
+This can also appear as 0x9192. Reported in bugzilla and confirmed with the
+board documentation for these boards.
+
+Resolves-bug: https://bugzilla.kernel.org/show_bug.cgi?id=42970
+Signed-off-by: Alan Cox <alan@linux.intel.com>
+Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/ata/ahci.c |    2 ++
+ 1 file changed, 2 insertions(+)
+
+--- a/drivers/ata/ahci.c
++++ b/drivers/ata/ahci.c
+@@ -394,6 +394,8 @@ static const struct pci_device_id ahci_p
+         .driver_data = board_ahci_yes_fbs },                  /* 88se9125 */
+       { PCI_DEVICE(0x1b4b, 0x917a),
+         .driver_data = board_ahci_yes_fbs },                  /* 88se9172 */
++      { PCI_DEVICE(0x1b4b, 0x9192),
++        .driver_data = board_ahci_yes_fbs },                  /* 88se9172 on some Gigabyte */
+       { PCI_DEVICE(0x1b4b, 0x91a3),
+         .driver_data = board_ahci_yes_fbs },
diff --git a/queue-3.0/fs-proc-fix-potential-unregister_sysctl_table-hang.patch b/queue-3.0/fs-proc-fix-potential-unregister_sysctl_table-hang.patch
new file mode 100644 (file)
index 0000000..37600d8
--- /dev/null
@@ -0,0 +1,55 @@
+From 6bf6104573482570f7103d3e5ddf9574db43a363 Mon Sep 17 00:00:00 2001
+From: Francesco Ruggeri <fruggeri@aristanetworks.com>
+Date: Thu, 13 Sep 2012 15:03:37 -0700
+Subject: fs/proc: fix potential unregister_sysctl_table hang
+
+From: Francesco Ruggeri <fruggeri@aristanetworks.com>
+
+commit 6bf6104573482570f7103d3e5ddf9574db43a363 upstream.
+
+The unregister_sysctl_table() function hangs if all references to its
+ctl_table_header structure are not dropped.
+
+This can happen sometimes because of a leak in proc_sys_lookup():
+proc_sys_lookup() gets a reference to the table via lookup_entry(), but
+it does not release it when a subsequent call to sysctl_follow_link()
+fails.
+
+This patch fixes this leak by making sure the reference is always
+dropped on return.
+
+See also commit 076c3eed2c31 ("sysctl: Rewrite proc_sys_lookup
+introducing find_entry and lookup_entry") which reorganized this code in
+3.4.
+
+Tested in Linux 3.4.4.
+
+Signed-off-by: Francesco Ruggeri <fruggeri@aristanetworks.com>
+Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ fs/proc/proc_sysctl.c |    5 ++---
+ 1 file changed, 2 insertions(+), 3 deletions(-)
+
+--- a/fs/proc/proc_sysctl.c
++++ b/fs/proc/proc_sysctl.c
+@@ -113,9 +113,6 @@ static struct dentry *proc_sys_lookup(st
+       err = ERR_PTR(-ENOMEM);
+       inode = proc_sys_make_inode(dir->i_sb, h ? h : head, p);
+-      if (h)
+-              sysctl_head_finish(h);
+-
+       if (!inode)
+               goto out;
+@@ -124,6 +121,8 @@ static struct dentry *proc_sys_lookup(st
+       d_add(dentry, inode);
+ out:
++      if (h)
++              sysctl_head_finish(h);
+       sysctl_head_finish(head);
+       return err;
+ }
diff --git a/queue-3.0/kobject-fix-oops-with-input0-bad-kobj_uevent_env-content-in-show_uevent.patch b/queue-3.0/kobject-fix-oops-with-input0-bad-kobj_uevent_env-content-in-show_uevent.patch
new file mode 100644 (file)
index 0000000..380c4cb
--- /dev/null
@@ -0,0 +1,75 @@
+From 60e233a56609fd963c59e99bd75c663d63fa91b6 Mon Sep 17 00:00:00 2001
+From: Bjørn Mork <bjorn@mork.no>
+Date: Sun, 2 Sep 2012 15:41:34 +0200
+Subject: kobject: fix oops with "input0: bad kobj_uevent_env content in show_uevent()"
+
+From: Bjørn Mork <bjorn@mork.no>
+
+commit 60e233a56609fd963c59e99bd75c663d63fa91b6 upstream.
+
+Fengguang Wu <fengguang.wu@intel.com> writes:
+
+> After the __devinit* removal series, I can still get kernel panic in
+> show_uevent(). So there are more sources of bug..
+>
+> Debug patch:
+>
+> @@ -343,8 +343,11 @@ static ssize_t show_uevent(struct device
+>                 goto out;
+>
+>         /* copy keys to file */
+> -       for (i = 0; i < env->envp_idx; i++)
+> +       dev_err(dev, "uevent %d env[%d]: %s/.../%s\n", env->buflen, env->envp_idx, top_kobj->name, dev->kobj.name);
+> +       for (i = 0; i < env->envp_idx; i++) {
+> +               printk(KERN_ERR "uevent %d env[%d]: %s\n", (int)count, i, env->envp[i]);
+>                 count += sprintf(&buf[count], "%s\n", env->envp[i]);
+> +       }
+>
+> Oops message, the env[] is again not properly initilized:
+>
+> [   44.068623] input input0: uevent 61 env[805306368]: input0/.../input0
+> [   44.069552] uevent 0 env[0]: (null)
+
+This is a completely different CONFIG_HOTPLUG problem, only
+demonstrating another reason why CONFIG_HOTPLUG should go away.  I had a
+hard time trying to disable it anyway ;-)
+
+The problem this time is lots of code assuming that a call to
+add_uevent_var() will guarantee that env->buflen > 0.  This is not true
+if CONFIG_HOTPLUG is unset.  So things like this end up overwriting
+env->envp_idx because the array index is -1:
+
+       if (add_uevent_var(env, "MODALIAS="))
+               return -ENOMEM;
+        len = input_print_modalias(&env->buf[env->buflen - 1],
+                                  sizeof(env->buf) - env->buflen,
+                                  dev, 0);
+
+Don't know what the best action is, given that there seem to be a *lot*
+of this around the kernel.  This patch "fixes" the problem for me, but I
+don't know if it can be considered an appropriate fix.
+
+[ It is the correct fix for now, for 3.7 forcing CONFIG_HOTPLUG to
+always be on is the longterm fix, but it's too late for 3.6 and older
+kernels to resolve this that way - gregkh ]
+
+Reported-by: Fengguang Wu <fengguang.wu@intel.com>
+Signed-off-by: Bjørn Mork <bjorn@mork.no>
+Tested-by: Fengguang Wu <fengguang.wu@intel.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ include/linux/kobject.h |    2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/include/linux/kobject.h
++++ b/include/linux/kobject.h
+@@ -228,7 +228,7 @@ static inline int kobject_uevent_env(str
+ static inline __attribute__((format(printf, 2, 3)))
+ int add_uevent_var(struct kobj_uevent_env *env, const char *format, ...)
+-{ return 0; }
++{ return -ENOMEM; }
+ static inline int kobject_action_type(const char *buf, size_t count,
+                                     enum kobject_action *type)
diff --git a/queue-3.0/mmc-mxs-mmc-fix-deadlock-in-sdio-irq-case.patch b/queue-3.0/mmc-mxs-mmc-fix-deadlock-in-sdio-irq-case.patch
new file mode 100644 (file)
index 0000000..2fa600d
--- /dev/null
@@ -0,0 +1,93 @@
+From 1af36b2a993dddfa3d6860ec4879c9e8abc9b976 Mon Sep 17 00:00:00 2001
+From: Lauri Hintsala <lauri.hintsala@bluegiga.com>
+Date: Tue, 17 Jul 2012 17:16:09 +0300
+Subject: mmc: mxs-mmc: fix deadlock in SDIO IRQ case
+
+From: Lauri Hintsala <lauri.hintsala@bluegiga.com>
+
+commit 1af36b2a993dddfa3d6860ec4879c9e8abc9b976 upstream.
+
+Release the lock before mmc_signal_sdio_irq is called by mxs_mmc_irq_handler.
+
+Backtrace:
+[   79.660000] =============================================
+[   79.660000] [ INFO: possible recursive locking detected ]
+[   79.660000] 3.4.0-00009-g3e96082-dirty #11 Not tainted
+[   79.660000] ---------------------------------------------
+[   79.660000] swapper/0 is trying to acquire lock:
+[   79.660000]  (&(&host->lock)->rlock#2){-.....}, at: [<c026ea3c>] mxs_mmc_enable_sdio_irq+0x18/0xd4
+[   79.660000]
+[   79.660000] but task is already holding lock:
+[   79.660000]  (&(&host->lock)->rlock#2){-.....}, at: [<c026f744>] mxs_mmc_irq_handler+0x1c/0xe8
+[   79.660000]
+[   79.660000] other info that might help us debug this:
+[   79.660000]  Possible unsafe locking scenario:
+[   79.660000]
+[   79.660000]        CPU0
+[   79.660000]        ----
+[   79.660000]   lock(&(&host->lock)->rlock#2);
+[   79.660000]   lock(&(&host->lock)->rlock#2);
+[   79.660000]
+[   79.660000]  *** DEADLOCK ***
+[   79.660000]
+[   79.660000]  May be due to missing lock nesting notation
+[   79.660000]
+[   79.660000] 1 lock held by swapper/0:
+[   79.660000]  #0:  (&(&host->lock)->rlock#2){-.....}, at: [<c026f744>] mxs_mmc_irq_handler+0x1c/0xe8
+[   79.660000]
+[   79.660000] stack backtrace:
+[   79.660000] [<c0014bd0>] (unwind_backtrace+0x0/0xf4) from [<c005f9c0>] (__lock_acquire+0x1948/0x1d48)
+[   79.660000] [<c005f9c0>] (__lock_acquire+0x1948/0x1d48) from [<c005fea0>] (lock_acquire+0xe0/0xf8)
+[   79.660000] [<c005fea0>] (lock_acquire+0xe0/0xf8) from [<c03a8460>] (_raw_spin_lock_irqsave+0x44/0x58)
+[   79.660000] [<c03a8460>] (_raw_spin_lock_irqsave+0x44/0x58) from [<c026ea3c>] (mxs_mmc_enable_sdio_irq+0x18/0xd4)
+[   79.660000] [<c026ea3c>] (mxs_mmc_enable_sdio_irq+0x18/0xd4) from [<c026f7fc>] (mxs_mmc_irq_handler+0xd4/0xe8)
+[   79.660000] [<c026f7fc>] (mxs_mmc_irq_handler+0xd4/0xe8) from [<c006bdd8>] (handle_irq_event_percpu+0x70/0x254)
+[   79.660000] [<c006bdd8>] (handle_irq_event_percpu+0x70/0x254) from [<c006bff8>] (handle_irq_event+0x3c/0x5c)
+[   79.660000] [<c006bff8>] (handle_irq_event+0x3c/0x5c) from [<c006e6d0>] (handle_level_irq+0x90/0x110)
+[   79.660000] [<c006e6d0>] (handle_level_irq+0x90/0x110) from [<c006b930>] (generic_handle_irq+0x38/0x50)
+[   79.660000] [<c006b930>] (generic_handle_irq+0x38/0x50) from [<c00102fc>] (handle_IRQ+0x30/0x84)
+[   79.660000] [<c00102fc>] (handle_IRQ+0x30/0x84) from [<c000f058>] (__irq_svc+0x38/0x60)
+[   79.660000] [<c000f058>] (__irq_svc+0x38/0x60) from [<c0010520>] (default_idle+0x2c/0x40)
+[   79.660000] [<c0010520>] (default_idle+0x2c/0x40) from [<c0010a90>] (cpu_idle+0x64/0xcc)
+[   79.660000] [<c0010a90>] (cpu_idle+0x64/0xcc) from [<c04ff858>] (start_kernel+0x244/0x2c8)
+[   79.660000] BUG: spinlock lockup on CPU#0, swapper/0
+[   79.660000]  lock: c398cb2c, .magic: dead4ead, .owner: swapper/0, .owner_cpu: 0
+[   79.660000] [<c0014bd0>] (unwind_backtrace+0x0/0xf4) from [<c01ddb1c>] (do_raw_spin_lock+0xf0/0x144)
+[   79.660000] [<c01ddb1c>] (do_raw_spin_lock+0xf0/0x144) from [<c03a8468>] (_raw_spin_lock_irqsave+0x4c/0x58)
+[   79.660000] [<c03a8468>] (_raw_spin_lock_irqsave+0x4c/0x58) from [<c026ea3c>] (mxs_mmc_enable_sdio_irq+0x18/0xd4)
+[   79.660000] [<c026ea3c>] (mxs_mmc_enable_sdio_irq+0x18/0xd4) from [<c026f7fc>] (mxs_mmc_irq_handler+0xd4/0xe8)
+[   79.660000] [<c026f7fc>] (mxs_mmc_irq_handler+0xd4/0xe8) from [<c006bdd8>] (handle_irq_event_percpu+0x70/0x254)
+[   79.660000] [<c006bdd8>] (handle_irq_event_percpu+0x70/0x254) from [<c006bff8>] (handle_irq_event+0x3c/0x5c)
+[   79.660000] [<c006bff8>] (handle_irq_event+0x3c/0x5c) from [<c006e6d0>] (handle_level_irq+0x90/0x110)
+[   79.660000] [<c006e6d0>] (handle_level_irq+0x90/0x110) from [<c006b930>] (generic_handle_irq+0x38/0x50)
+[   79.660000] [<c006b930>] (generic_handle_irq+0x38/0x50) from [<c00102fc>] (handle_IRQ+0x30/0x84)
+[   79.660000] [<c00102fc>] (handle_IRQ+0x30/0x84) from [<c000f058>] (__irq_svc+0x38/0x60)
+[   79.660000] [<c000f058>] (__irq_svc+0x38/0x60) from [<c0010520>] (default_idle+0x2c/0x40)
+[   79.660000] [<c0010520>] (default_idle+0x2c/0x40) from [<c0010a90>] (cpu_idle+0x64/0xcc)
+[   79.660000] [<c0010a90>] (cpu_idle+0x64/0xcc) from [<c04ff858>] (start_kernel+0x244/0x2c8)
+
+Signed-off-by: Lauri Hintsala <lauri.hintsala@bluegiga.com>
+Acked-by: Shawn Guo <shawn.guo@linaro.org>
+Signed-off-by: Chris Ball <cjb@laptop.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/mmc/host/mxs-mmc.c |    4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+--- a/drivers/mmc/host/mxs-mmc.c
++++ b/drivers/mmc/host/mxs-mmc.c
+@@ -278,11 +278,11 @@ static irqreturn_t mxs_mmc_irq_handler(i
+       writel(stat & MXS_MMC_IRQ_BITS,
+              host->base + HW_SSP_CTRL1 + MXS_CLR_ADDR);
++      spin_unlock(&host->lock);
++
+       if ((stat & BM_SSP_CTRL1_SDIO_IRQ) && (stat & BM_SSP_CTRL1_SDIO_IRQ_EN))
+               mmc_signal_sdio_irq(host->mmc);
+-      spin_unlock(&host->lock);
+-
+       if (stat & BM_SSP_CTRL1_RESP_TIMEOUT_IRQ)
+               cmd->error = -ETIMEDOUT;
+       else if (stat & BM_SSP_CTRL1_RESP_ERR_IRQ)
diff --git a/queue-3.0/mmc-sdhci-esdhc-break-out-early-if-clock-is-0.patch b/queue-3.0/mmc-sdhci-esdhc-break-out-early-if-clock-is-0.patch
new file mode 100644 (file)
index 0000000..aece298
--- /dev/null
@@ -0,0 +1,43 @@
+From 74f330bceaa7b88d06062e1cac3d519a3dfc041e Mon Sep 17 00:00:00 2001
+From: Shawn Guo <shawn.guo@linaro.org>
+Date: Wed, 22 Aug 2012 23:10:01 +0800
+Subject: mmc: sdhci-esdhc: break out early if clock is 0
+
+From: Shawn Guo <shawn.guo@linaro.org>
+
+commit 74f330bceaa7b88d06062e1cac3d519a3dfc041e upstream.
+
+Since commit 30832ab56 ("mmc: sdhci: Always pass clock request value
+zero to set_clock host op") was merged, esdhc_set_clock starts hitting
+"if (clock == 0)" where ESDHC_SYSTEM_CONTROL has been operated.  This
+causes SDHCI card-detection function being broken.  Fix the regression
+by moving "if (clock == 0)" above ESDHC_SYSTEM_CONTROL operation.
+
+Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
+Signed-off-by: Chris Ball <cjb@laptop.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/mmc/host/sdhci-esdhc.h |    6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+--- a/drivers/mmc/host/sdhci-esdhc.h
++++ b/drivers/mmc/host/sdhci-esdhc.h
+@@ -48,14 +48,14 @@ static inline void esdhc_set_clock(struc
+       int div = 1;
+       u32 temp;
++      if (clock == 0)
++              goto out;
++
+       temp = sdhci_readl(host, ESDHC_SYSTEM_CONTROL);
+       temp &= ~(ESDHC_CLOCK_IPGEN | ESDHC_CLOCK_HCKEN | ESDHC_CLOCK_PEREN
+               | ESDHC_CLOCK_MASK);
+       sdhci_writel(host, temp, ESDHC_SYSTEM_CONTROL);
+-      if (clock == 0)
+-              goto out;
+-
+       while (host->max_clk / pre_div / 16 > clock && pre_div < 256)
+               pre_div *= 2;
diff --git a/queue-3.0/perf_event-switch-to-internal-refcount-fix-race-with-close.patch b/queue-3.0/perf_event-switch-to-internal-refcount-fix-race-with-close.patch
new file mode 100644 (file)
index 0000000..be259e0
--- /dev/null
@@ -0,0 +1,217 @@
+From a6fa941d94b411bbd2b6421ffbde6db3c93e65ab Mon Sep 17 00:00:00 2001
+From: Al Viro <viro@ZenIV.linux.org.uk>
+Date: Mon, 20 Aug 2012 14:59:25 +0100
+Subject: perf_event: Switch to internal refcount, fix race with close()
+
+From: Al Viro <viro@ZenIV.linux.org.uk>
+
+commit a6fa941d94b411bbd2b6421ffbde6db3c93e65ab upstream.
+
+Don't mess with file refcounts (or keep a reference to file, for
+that matter) in perf_event.  Use explicit refcount of its own
+instead.  Deal with the race between the final reference to event
+going away and new children getting created for it by use of
+atomic_long_inc_not_zero() in inherit_event(); just have the
+latter free what it had allocated and return NULL, that works
+out just fine (children of siblings of something doomed are
+created as singletons, same as if the child of leader had been
+created and immediately killed).
+
+Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
+Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
+Link: http://lkml.kernel.org/r/20120820135925.GG23464@ZenIV.linux.org.uk
+Signed-off-by: Ingo Molnar <mingo@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ include/linux/perf_event.h |    2 -
+ kernel/events/core.c       |   62 +++++++++++++++++++++++----------------------
+ 2 files changed, 34 insertions(+), 30 deletions(-)
+
+--- a/include/linux/perf_event.h
++++ b/include/linux/perf_event.h
+@@ -807,7 +807,7 @@ struct perf_event {
+       struct hw_perf_event            hw;
+       struct perf_event_context       *ctx;
+-      struct file                     *filp;
++      atomic_long_t                   refcount;
+       /*
+        * These accumulate total time (in nanoseconds) that children
+--- a/kernel/events/core.c
++++ b/kernel/events/core.c
+@@ -2969,12 +2969,12 @@ EXPORT_SYMBOL_GPL(perf_event_release_ker
+ /*
+  * Called when the last reference to the file is gone.
+  */
+-static int perf_release(struct inode *inode, struct file *file)
++static void put_event(struct perf_event *event)
+ {
+-      struct perf_event *event = file->private_data;
+       struct task_struct *owner;
+-      file->private_data = NULL;
++      if (!atomic_long_dec_and_test(&event->refcount))
++              return;
+       rcu_read_lock();
+       owner = ACCESS_ONCE(event->owner);
+@@ -3009,7 +3009,13 @@ static int perf_release(struct inode *in
+               put_task_struct(owner);
+       }
+-      return perf_event_release_kernel(event);
++      perf_event_release_kernel(event);
++}
++
++static int perf_release(struct inode *inode, struct file *file)
++{
++      put_event(file->private_data);
++      return 0;
+ }
+ u64 perf_event_read_value(struct perf_event *event, u64 *enabled, u64 *running)
+@@ -3241,7 +3247,7 @@ unlock:
+ static const struct file_operations perf_fops;
+-static struct perf_event *perf_fget_light(int fd, int *fput_needed)
++static struct file *perf_fget_light(int fd, int *fput_needed)
+ {
+       struct file *file;
+@@ -3255,7 +3261,7 @@ static struct perf_event *perf_fget_ligh
+               return ERR_PTR(-EBADF);
+       }
+-      return file->private_data;
++      return file;
+ }
+ static int perf_event_set_output(struct perf_event *event,
+@@ -3287,19 +3293,21 @@ static long perf_ioctl(struct file *file
+       case PERF_EVENT_IOC_SET_OUTPUT:
+       {
++              struct file *output_file = NULL;
+               struct perf_event *output_event = NULL;
+               int fput_needed = 0;
+               int ret;
+               if (arg != -1) {
+-                      output_event = perf_fget_light(arg, &fput_needed);
+-                      if (IS_ERR(output_event))
+-                              return PTR_ERR(output_event);
++                      output_file = perf_fget_light(arg, &fput_needed);
++                      if (IS_ERR(output_file))
++                              return PTR_ERR(output_file);
++                      output_event = output_file->private_data;
+               }
+               ret = perf_event_set_output(event, output_event);
+               if (output_event)
+-                      fput_light(output_event->filp, fput_needed);
++                      fput_light(output_file, fput_needed);
+               return ret;
+       }
+@@ -6181,6 +6189,7 @@ perf_event_alloc(struct perf_event_attr
+       mutex_init(&event->mmap_mutex);
++      atomic_long_set(&event->refcount, 1);
+       event->cpu              = cpu;
+       event->attr             = *attr;
+       event->group_leader     = group_leader;
+@@ -6455,12 +6464,12 @@ SYSCALL_DEFINE5(perf_event_open,
+               return event_fd;
+       if (group_fd != -1) {
+-              group_leader = perf_fget_light(group_fd, &fput_needed);
+-              if (IS_ERR(group_leader)) {
+-                      err = PTR_ERR(group_leader);
++              group_file = perf_fget_light(group_fd, &fput_needed);
++              if (IS_ERR(group_file)) {
++                      err = PTR_ERR(group_file);
+                       goto err_fd;
+               }
+-              group_file = group_leader->filp;
++              group_leader = group_file->private_data;
+               if (flags & PERF_FLAG_FD_OUTPUT)
+                       output_event = group_leader;
+               if (flags & PERF_FLAG_FD_NO_GROUP)
+@@ -6594,7 +6603,6 @@ SYSCALL_DEFINE5(perf_event_open,
+               put_ctx(gctx);
+       }
+-      event->filp = event_file;
+       WARN_ON_ONCE(ctx->parent_ctx);
+       mutex_lock(&ctx->mutex);
+@@ -6682,7 +6690,6 @@ perf_event_create_kernel_counter(struct
+               goto err_free;
+       }
+-      event->filp = NULL;
+       WARN_ON_ONCE(ctx->parent_ctx);
+       mutex_lock(&ctx->mutex);
+       perf_install_in_context(ctx, event, cpu);
+@@ -6731,7 +6738,7 @@ static void sync_child_event(struct perf
+        * Release the parent event, if this was the last
+        * reference to it.
+        */
+-      fput(parent_event->filp);
++      put_event(parent_event);
+ }
+ static void
+@@ -6807,9 +6814,8 @@ static void perf_event_exit_task_context
+        *
+        *   __perf_event_exit_task()
+        *     sync_child_event()
+-       *       fput(parent_event->filp)
+-       *         perf_release()
+-       *           mutex_lock(&ctx->mutex)
++       *       put_event()
++       *         mutex_lock(&ctx->mutex)
+        *
+        * But since its the parent context it won't be the same instance.
+        */
+@@ -6877,7 +6883,7 @@ static void perf_free_event(struct perf_
+       list_del_init(&event->child_list);
+       mutex_unlock(&parent->child_mutex);
+-      fput(parent->filp);
++      put_event(parent);
+       perf_group_detach(event);
+       list_del_event(event, ctx);
+@@ -6957,6 +6963,12 @@ inherit_event(struct perf_event *parent_
+                                          NULL);
+       if (IS_ERR(child_event))
+               return child_event;
++
++      if (!atomic_long_inc_not_zero(&parent_event->refcount)) {
++              free_event(child_event);
++              return NULL;
++      }
++
+       get_ctx(child_ctx);
+       /*
+@@ -6996,14 +7008,6 @@ inherit_event(struct perf_event *parent_
+       raw_spin_unlock_irqrestore(&child_ctx->lock, flags);
+       /*
+-       * Get a reference to the parent filp - we will fput it
+-       * when the child event exits. This is safe to do because
+-       * we are in the parent and we know that the filp still
+-       * exists and has a nonzero count:
+-       */
+-      atomic_long_inc(&parent_event->filp->f_count);
+-
+-      /*
+        * Link this into the parent event's child list
+        */
+       WARN_ON_ONCE(parent_event->ctx->parent_ctx);
diff --git a/queue-3.0/redefine-atomic_init-and-atomic64_init-to-drop-the-casts.patch b/queue-3.0/redefine-atomic_init-and-atomic64_init-to-drop-the-casts.patch
new file mode 100644 (file)
index 0000000..c8a39ad
--- /dev/null
@@ -0,0 +1,51 @@
+From 67a806d9499353fabd5b5ff07337f3aa88a1c3ba Mon Sep 17 00:00:00 2001
+From: Mel Gorman <mgorman@suse.de>
+Date: Sun, 19 Aug 2012 14:41:03 +1200
+Subject: Redefine ATOMIC_INIT and ATOMIC64_INIT to drop the casts
+
+From: Mel Gorman <mgorman@suse.de>
+
+commit 67a806d9499353fabd5b5ff07337f3aa88a1c3ba upstream.
+
+The following build error occurred during an alpha build:
+
+  net/core/sock.c:274:36: error: initializer element is not constant
+
+Dave Anglin says:
+> Here is the line in sock.i:
+>
+> struct static_key memalloc_socks = ((struct static_key) { .enabled =
+> ((atomic_t) { (0) }) });
+
+The above line contains two compound literals.  It also uses a designated
+initializer to initialize the field enabled.  A compound literal is not a
+constant expression.
+
+The location of the above statement isn't fully clear, but if a compound
+literal occurs outside the body of a function, the initializer list must
+consist of constant expressions.
+
+Signed-off-by: Mel Gorman <mgorman@suse.de>
+Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
+Signed-off-by: Michael Cree <mcree@orcon.net.nz>
+Acked-by: Matt Turner <mattst88@gmail.com>
+Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ arch/alpha/include/asm/atomic.h |    4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+--- a/arch/alpha/include/asm/atomic.h
++++ b/arch/alpha/include/asm/atomic.h
+@@ -14,8 +14,8 @@
+  */
+-#define ATOMIC_INIT(i)                ( (atomic_t) { (i) } )
+-#define ATOMIC64_INIT(i)      ( (atomic64_t) { (i) } )
++#define ATOMIC_INIT(i)                { (i) }
++#define ATOMIC64_INIT(i)      { (i) }
+ #define atomic_read(v)                (*(volatile int *)&(v)->counter)
+ #define atomic64_read(v)      (*(volatile long *)&(v)->counter)
index eaab630a870839c149a2c86d8808b5d310e0c490..61c2bd11eb828437c851267066ea8cdcc0092d2c 100644 (file)
@@ -35,3 +35,10 @@ staging-vt6656-failed-connection-incorrect-endian.patch
 staging-r8712u-fix-bug-in-r8712_recv_indicatepkt.patch
 staging-comedi-das08-correct-ao-output-for-das08jr-16-ao.patch
 usb-option-replace-zte-k5006-z-entry-with-vendor-class-rule.patch
+fs-proc-fix-potential-unregister_sysctl_table-hang.patch
+perf_event-switch-to-internal-refcount-fix-race-with-close.patch
+mmc-mxs-mmc-fix-deadlock-in-sdio-irq-case.patch
+mmc-sdhci-esdhc-break-out-early-if-clock-is-0.patch
+ahci-add-alternate-identifier-for-the-88se9172.patch
+kobject-fix-oops-with-input0-bad-kobj_uevent_env-content-in-show_uevent.patch
+redefine-atomic_init-and-atomic64_init-to-drop-the-casts.patch