]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
4.4-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 1 Jun 2020 17:01:03 +0000 (19:01 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 1 Jun 2020 17:01:03 +0000 (19:01 +0200)
added patches:
asm-prototypes-clear-any-cpp-defines-before-declaring-the-functions.patch
drm-msm-fix-possible-null-dereference-on-failure-of-get_pages.patch
genirq-generic_pending-do-not-lose-pending-affinity-update.patch
mac80211-fix-memory-leak.patch
mm-vmalloc.c-don-t-dereference-possible-null-pointer-in-__vunmap.patch
net-rtnl_configure_link-fix-dev-flags-changes-arg-to-__dev_notify_flags.patch
sc16is7xx-move-label-err_spi-to-correct-section.patch
usb-renesas_usbhs-gadget-fix-spin_lock_init-for-uep-lock.patch

queue-4.4/asm-prototypes-clear-any-cpp-defines-before-declaring-the-functions.patch [new file with mode: 0644]
queue-4.4/drm-msm-fix-possible-null-dereference-on-failure-of-get_pages.patch [new file with mode: 0644]
queue-4.4/genirq-generic_pending-do-not-lose-pending-affinity-update.patch [new file with mode: 0644]
queue-4.4/mac80211-fix-memory-leak.patch [new file with mode: 0644]
queue-4.4/mm-vmalloc.c-don-t-dereference-possible-null-pointer-in-__vunmap.patch [new file with mode: 0644]
queue-4.4/net-rtnl_configure_link-fix-dev-flags-changes-arg-to-__dev_notify_flags.patch [new file with mode: 0644]
queue-4.4/sc16is7xx-move-label-err_spi-to-correct-section.patch [new file with mode: 0644]
queue-4.4/series
queue-4.4/usb-renesas_usbhs-gadget-fix-spin_lock_init-for-uep-lock.patch [new file with mode: 0644]

diff --git a/queue-4.4/asm-prototypes-clear-any-cpp-defines-before-declaring-the-functions.patch b/queue-4.4/asm-prototypes-clear-any-cpp-defines-before-declaring-the-functions.patch
new file mode 100644 (file)
index 0000000..4462da9
--- /dev/null
@@ -0,0 +1,79 @@
+From c7858bf16c0b2cc62f475f31e6df28c3a68da1d6 Mon Sep 17 00:00:00 2001
+From: Michal Marek <mmarek@suse.com>
+Date: Tue, 3 Jan 2017 13:49:42 +0100
+Subject: asm-prototypes: Clear any CPP defines before declaring the functions
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Michal Marek <mmarek@suse.com>
+
+commit c7858bf16c0b2cc62f475f31e6df28c3a68da1d6 upstream.
+
+The asm-prototypes.h file is used to provide dummy function declarations
+for genksyms, when processing asm files with EXPORT_SYMBOL. Make sure
+that any architecture defines get out of our way. x86 currently has an
+issue with memcpy on 64bit with CONFIG_KMEMCHECK=y and with
+memset/__memset on 32bit:
+
+       $ cat init/test.c
+       #include <asm/asm-prototypes.h>
+       $ make -s init/test.o
+       In file included from ./arch/x86/include/asm/string.h:4:0,
+                        from ./include/linux/string.h:18,
+                        from ./include/linux/bitmap.h:8,
+                        from ./include/linux/cpumask.h:11,
+                        from ./arch/x86/include/asm/cpumask.h:4,
+                        from ./arch/x86/include/asm/msr.h:10,
+                        from ./arch/x86/include/asm/processor.h:20,
+                        from ./arch/x86/include/asm/cpufeature.h:4,
+                        from ./arch/x86/include/asm/thread_info.h:52,
+                        from ./include/linux/thread_info.h:25,
+                        from ./arch/x86/include/asm/preempt.h:6,
+                        from ./include/linux/preempt.h:59,
+                        from ./include/linux/spinlock.h:50,
+                        from ./include/linux/seqlock.h:35,
+                        from ./include/linux/time.h:5,
+                        from ./include/uapi/linux/timex.h:56,
+                        from ./include/linux/timex.h:56,
+                        from ./include/linux/sched.h:19,
+                        from ./include/linux/uaccess.h:4,
+                        from ./arch/x86/include/asm/asm-prototypes.h:2,
+                        from init/test.c:1:
+       ./arch/x86/include/asm/string_64.h:52:47: error: expected declaration specifiers or ‘...’ before ‘(’ token
+        #define memcpy(dst, src, len) __inline_memcpy((dst), (src), (len))
+        ./include/asm-generic/asm-prototypes.h:6:14: note: in expansion of macro ‘memcpy’
+         extern void *memcpy(void *, const void *, __kernel_size_t);
+
+                                                      ^
+       ...
+
+During real build, this manifests itself by genksyms segfaulting.
+
+Fixes: 334bb7738764 ("x86/kbuild: enable modversions for symbols exported from asm")
+Reported-and-tested-by: Borislav Petkov <bp@alien8.de>
+Cc: Adam Borowski <kilobyte@angband.pl>
+Signed-off-by: Michal Marek <mmarek@suse.com>
+Cc: Guenter Roeck <linux@roeck-us.net>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ include/asm-generic/asm-prototypes.h |    6 ++++++
+ 1 file changed, 6 insertions(+)
+
+--- a/include/asm-generic/asm-prototypes.h
++++ b/include/asm-generic/asm-prototypes.h
+@@ -1,7 +1,13 @@
+ #include <linux/bitops.h>
++#undef __memset
+ extern void *__memset(void *, int, __kernel_size_t);
++#undef __memcpy
+ extern void *__memcpy(void *, const void *, __kernel_size_t);
++#undef __memmove
+ extern void *__memmove(void *, const void *, __kernel_size_t);
++#undef memset
+ extern void *memset(void *, int, __kernel_size_t);
++#undef memcpy
+ extern void *memcpy(void *, const void *, __kernel_size_t);
++#undef memmove
+ extern void *memmove(void *, const void *, __kernel_size_t);
diff --git a/queue-4.4/drm-msm-fix-possible-null-dereference-on-failure-of-get_pages.patch b/queue-4.4/drm-msm-fix-possible-null-dereference-on-failure-of-get_pages.patch
new file mode 100644 (file)
index 0000000..f95ec79
--- /dev/null
@@ -0,0 +1,63 @@
+From 3976626ea3d2011f8fd3f3a47070a8b792018253 Mon Sep 17 00:00:00 2001
+From: Ben Hutchings <ben.hutchings@codethink.co.uk>
+Date: Tue, 3 Apr 2018 23:38:45 +0100
+Subject: drm/msm: Fix possible null dereference on failure of get_pages()
+
+From: Ben Hutchings <ben.hutchings@codethink.co.uk>
+
+commit 3976626ea3d2011f8fd3f3a47070a8b792018253 upstream.
+
+Commit 62e3a3e342af changed get_pages() to initialise
+msm_gem_object::pages before trying to initialise msm_gem_object::sgt,
+so that put_pages() would properly clean up pages in the failure
+case.
+
+However, this means that put_pages() now needs to check that
+msm_gem_object::sgt is not null before trying to clean it up, and
+this check was only applied to part of the cleanup code.  Move
+it all into the conditional block.  (Strictly speaking we don't
+need to make the kfree() conditional, but since we can't avoid
+checking for null ourselves we may as well do so.)
+
+Fixes: 62e3a3e342af ("drm/msm: fix leak in failed get_pages")
+Signed-off-by: Ben Hutchings <ben.hutchings@codethink.co.uk>
+Reviewed-by: Jordan Crouse <jcrouse@codeaurora.org>
+Signed-off-by: Rob Clark <robdclark@gmail.com>
+Cc: Guenter Roeck <linux@roeck-us.net>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/gpu/drm/msm/msm_gem.c |   20 +++++++++++---------
+ 1 file changed, 11 insertions(+), 9 deletions(-)
+
+--- a/drivers/gpu/drm/msm/msm_gem.c
++++ b/drivers/gpu/drm/msm/msm_gem.c
+@@ -116,17 +116,19 @@ static void put_pages(struct drm_gem_obj
+       struct msm_gem_object *msm_obj = to_msm_bo(obj);
+       if (msm_obj->pages) {
+-              /* For non-cached buffers, ensure the new pages are clean
+-               * because display controller, GPU, etc. are not coherent:
+-               */
+-              if (msm_obj->flags & (MSM_BO_WC|MSM_BO_UNCACHED))
+-                      dma_unmap_sg(obj->dev->dev, msm_obj->sgt->sgl,
+-                                      msm_obj->sgt->nents, DMA_BIDIRECTIONAL);
++              if (msm_obj->sgt) {
++                      /* For non-cached buffers, ensure the new
++                       * pages are clean because display controller,
++                       * GPU, etc. are not coherent:
++                       */
++                      if (msm_obj->flags & (MSM_BO_WC|MSM_BO_UNCACHED))
++                              dma_unmap_sg(obj->dev->dev, msm_obj->sgt->sgl,
++                                           msm_obj->sgt->nents,
++                                           DMA_BIDIRECTIONAL);
+-              if (msm_obj->sgt)
+                       sg_free_table(msm_obj->sgt);
+-
+-              kfree(msm_obj->sgt);
++                      kfree(msm_obj->sgt);
++              }
+               if (use_pages(obj))
+                       drm_gem_put_pages(obj, msm_obj->pages, true, false);
diff --git a/queue-4.4/genirq-generic_pending-do-not-lose-pending-affinity-update.patch b/queue-4.4/genirq-generic_pending-do-not-lose-pending-affinity-update.patch
new file mode 100644 (file)
index 0000000..5a387ae
--- /dev/null
@@ -0,0 +1,89 @@
+From a33a5d2d16cb84bea8d5f5510f3a41aa48b5c467 Mon Sep 17 00:00:00 2001
+From: Thomas Gleixner <tglx@linutronix.de>
+Date: Mon, 4 Jun 2018 17:33:54 +0200
+Subject: genirq/generic_pending: Do not lose pending affinity update
+
+From: Thomas Gleixner <tglx@linutronix.de>
+
+commit a33a5d2d16cb84bea8d5f5510f3a41aa48b5c467 upstream.
+
+The generic pending interrupt mechanism moves interrupts from the interrupt
+handler on the original target CPU to the new destination CPU. This is
+required for x86 and ia64 due to the way the interrupt delivery and
+acknowledge works if the interrupts are not remapped.
+
+However that update can fail for various reasons. Some of them are valid
+reasons to discard the pending update, but the case, when the previous move
+has not been fully cleaned up is not a legit reason to fail.
+
+Check the return value of irq_do_set_affinity() for -EBUSY, which indicates
+a pending cleanup, and rearm the pending move in the irq dexcriptor so it's
+tried again when the next interrupt arrives.
+
+Fixes: 996c591227d9 ("x86/irq: Plug vector cleanup race")
+Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
+Tested-by: Song Liu <songliubraving@fb.com>
+Cc: Joerg Roedel <jroedel@suse.de>
+Cc: Peter Zijlstra <peterz@infradead.org>
+Cc: Song Liu <liu.song.a23@gmail.com>
+Cc: Dmitry Safonov <0x7f454c46@gmail.com>
+Cc: stable@vger.kernel.org
+Cc: Mike Travis <mike.travis@hpe.com>
+Cc: Borislav Petkov <bp@alien8.de>
+Cc: Tariq Toukan <tariqt@mellanox.com>
+Cc: Guenter Roeck <linux@roeck-us.net>
+Link: https://lkml.kernel.org/r/20180604162224.386544292@linutronix.de
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ kernel/irq/migration.c |   24 ++++++++++++++++++------
+ 1 file changed, 18 insertions(+), 6 deletions(-)
+
+--- a/kernel/irq/migration.c
++++ b/kernel/irq/migration.c
+@@ -7,17 +7,18 @@
+ void irq_move_masked_irq(struct irq_data *idata)
+ {
+       struct irq_desc *desc = irq_data_to_desc(idata);
+-      struct irq_chip *chip = desc->irq_data.chip;
++      struct irq_data *data = &desc->irq_data;
++      struct irq_chip *chip = data->chip;
+-      if (likely(!irqd_is_setaffinity_pending(&desc->irq_data)))
++      if (likely(!irqd_is_setaffinity_pending(data)))
+               return;
+-      irqd_clr_move_pending(&desc->irq_data);
++      irqd_clr_move_pending(data);
+       /*
+        * Paranoia: cpu-local interrupts shouldn't be calling in here anyway.
+        */
+-      if (irqd_is_per_cpu(&desc->irq_data)) {
++      if (irqd_is_per_cpu(data)) {
+               WARN_ON(1);
+               return;
+       }
+@@ -42,9 +43,20 @@ void irq_move_masked_irq(struct irq_data
+        * For correct operation this depends on the caller
+        * masking the irqs.
+        */
+-      if (cpumask_any_and(desc->pending_mask, cpu_online_mask) < nr_cpu_ids)
+-              irq_do_set_affinity(&desc->irq_data, desc->pending_mask, false);
++      if (cpumask_any_and(desc->pending_mask, cpu_online_mask) < nr_cpu_ids) {
++              int ret;
++              ret = irq_do_set_affinity(data, desc->pending_mask, false);
++              /*
++               * If the there is a cleanup pending in the underlying
++               * vector management, reschedule the move for the next
++               * interrupt. Leave desc->pending_mask intact.
++               */
++              if (ret == -EBUSY) {
++                      irqd_set_move_pending(data);
++                      return;
++              }
++      }
+       cpumask_clear(desc->pending_mask);
+ }
diff --git a/queue-4.4/mac80211-fix-memory-leak.patch b/queue-4.4/mac80211-fix-memory-leak.patch
new file mode 100644 (file)
index 0000000..49cc9bc
--- /dev/null
@@ -0,0 +1,33 @@
+From ea32f065bd3e3e09f0bcb3042f1664caf6b3e233 Mon Sep 17 00:00:00 2001
+From: Sudip Mukherjee <sudip@vectorindia.org>
+Date: Tue, 2 Feb 2016 13:21:14 +0530
+Subject: mac80211: fix memory leak
+
+From: Sudip Mukherjee <sudip@vectorindia.org>
+
+commit ea32f065bd3e3e09f0bcb3042f1664caf6b3e233 upstream.
+
+On error we jumped to the error label and returned the error code but we
+missed releasing sinfo.
+
+Fixes: 5fe74014172d ("mac80211: avoid excessive stack usage in sta_info")
+Reviewed-by: Julian Calaby <julian.calaby@gmail.com>
+Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org>
+Signed-off-by: Johannes Berg <johannes.berg@intel.com>
+Cc: Guenter Roeck <linux@roeck-us.net>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ net/mac80211/sta_info.c |    1 +
+ 1 file changed, 1 insertion(+)
+
+--- a/net/mac80211/sta_info.c
++++ b/net/mac80211/sta_info.c
+@@ -555,6 +555,7 @@ static int sta_info_insert_finish(struct
+       __cleanup_single_sta(sta);
+  out_err:
+       mutex_unlock(&local->sta_mtx);
++      kfree(sinfo);
+       rcu_read_lock();
+       return err;
+ }
diff --git a/queue-4.4/mm-vmalloc.c-don-t-dereference-possible-null-pointer-in-__vunmap.patch b/queue-4.4/mm-vmalloc.c-don-t-dereference-possible-null-pointer-in-__vunmap.patch
new file mode 100644 (file)
index 0000000..5b32362
--- /dev/null
@@ -0,0 +1,40 @@
+From 6ade20327dbb808882888ed8ccded71e93067cf9 Mon Sep 17 00:00:00 2001
+From: Liviu Dudau <liviu@dudau.co.uk>
+Date: Tue, 5 Mar 2019 15:42:54 -0800
+Subject: mm/vmalloc.c: don't dereference possible NULL pointer in __vunmap()
+
+From: Liviu Dudau <liviu@dudau.co.uk>
+
+commit 6ade20327dbb808882888ed8ccded71e93067cf9 upstream.
+
+find_vmap_area() can return a NULL pointer and we're going to
+dereference it without checking it first.  Use the existing
+find_vm_area() function which does exactly what we want and checks for
+the NULL pointer.
+
+Link: http://lkml.kernel.org/r/20181228171009.22269-1-liviu@dudau.co.uk
+Fixes: f3c01d2f3ade ("mm: vmalloc: avoid racy handling of debugobjects in vunmap")
+Signed-off-by: Liviu Dudau <liviu@dudau.co.uk>
+Reviewed-by: Andrew Morton <akpm@linux-foundation.org>
+Cc: Chintan Pandya <cpandya@codeaurora.org>
+Cc: Andrey Ryabinin <aryabinin@virtuozzo.com>
+Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
+Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
+Cc: Guenter Roeck <linux@roeck-us.net>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ mm/vmalloc.c |    2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/mm/vmalloc.c
++++ b/mm/vmalloc.c
+@@ -1464,7 +1464,7 @@ static void __vunmap(const void *addr, i
+                       addr))
+               return;
+-      area = find_vmap_area((unsigned long)addr)->vm;
++      area = find_vm_area(addr);
+       if (unlikely(!area)) {
+               WARN(1, KERN_ERR "Trying to vfree() nonexistent vm area (%p)\n",
+                               addr);
diff --git a/queue-4.4/net-rtnl_configure_link-fix-dev-flags-changes-arg-to-__dev_notify_flags.patch b/queue-4.4/net-rtnl_configure_link-fix-dev-flags-changes-arg-to-__dev_notify_flags.patch
new file mode 100644 (file)
index 0000000..7588d06
--- /dev/null
@@ -0,0 +1,37 @@
+From 56a49d7048703f5ffdb84d3a0ee034108fba6850 Mon Sep 17 00:00:00 2001
+From: Roopa Prabhu <roopa@cumulusnetworks.com>
+Date: Wed, 12 Sep 2018 13:21:48 -0700
+Subject: net: rtnl_configure_link: fix dev flags changes arg to __dev_notify_flags
+
+From: Roopa Prabhu <roopa@cumulusnetworks.com>
+
+commit 56a49d7048703f5ffdb84d3a0ee034108fba6850 upstream.
+
+This fix addresses https://bugzilla.kernel.org/show_bug.cgi?id=201071
+
+Commit 5025f7f7d506 wrongly relied on __dev_change_flags to notify users of
+dev flag changes in the case when dev->rtnl_link_state = RTNL_LINK_INITIALIZED.
+Fix it by indicating flag changes explicitly to __dev_notify_flags.
+
+Fixes: 5025f7f7d506 ("rtnetlink: add rtnl_link_state check in rtnl_configure_link")
+Reported-By: Liam mcbirnie <liam.mcbirnie@boeing.com>
+Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+Cc: Guenter Roeck <linux@roeck-us.net>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ net/core/rtnetlink.c |    2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/net/core/rtnetlink.c
++++ b/net/core/rtnetlink.c
+@@ -2105,7 +2105,7 @@ int rtnl_configure_link(struct net_devic
+       }
+       if (dev->rtnl_link_state == RTNL_LINK_INITIALIZED) {
+-              __dev_notify_flags(dev, old_flags, 0U);
++              __dev_notify_flags(dev, old_flags, (old_flags ^ dev->flags));
+       } else {
+               dev->rtnl_link_state = RTNL_LINK_INITIALIZED;
+               __dev_notify_flags(dev, old_flags, ~0U);
diff --git a/queue-4.4/sc16is7xx-move-label-err_spi-to-correct-section.patch b/queue-4.4/sc16is7xx-move-label-err_spi-to-correct-section.patch
new file mode 100644 (file)
index 0000000..6989c83
--- /dev/null
@@ -0,0 +1,45 @@
+From e00164a0f000de893944981f41a568c981aca658 Mon Sep 17 00:00:00 2001
+From: Guoqing Jiang <gqjiang@suse.com>
+Date: Tue, 9 Apr 2019 16:16:38 +0800
+Subject: sc16is7xx: move label 'err_spi' to correct section
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Guoqing Jiang <gqjiang@suse.com>
+
+commit e00164a0f000de893944981f41a568c981aca658 upstream.
+
+err_spi is used when SERIAL_SC16IS7XX_SPI is enabled, so make
+the label only available under SERIAL_SC16IS7XX_SPI option.
+Otherwise, the below warning appears.
+
+drivers/tty/serial/sc16is7xx.c:1523:1: warning: label ‘err_spi’ defined but not used [-Wunused-label]
+ err_spi:
+  ^~~~~~~
+
+Signed-off-by: Guoqing Jiang <gqjiang@suse.com>
+Fixes: ac0cdb3d9901 ("sc16is7xx: missing unregister/delete driver on error in sc16is7xx_init()")
+Signed-off-by: Arnd Bergmann <arnd@arndb.de>
+Cc: Guenter Roeck <linux@roeck-us.net>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/tty/serial/sc16is7xx.c |    2 ++
+ 1 file changed, 2 insertions(+)
+
+--- a/drivers/tty/serial/sc16is7xx.c
++++ b/drivers/tty/serial/sc16is7xx.c
+@@ -1489,10 +1489,12 @@ static int __init sc16is7xx_init(void)
+ #endif
+       return ret;
++#ifdef CONFIG_SERIAL_SC16IS7XX_SPI
+ err_spi:
+ #ifdef CONFIG_SERIAL_SC16IS7XX_I2C
+       i2c_del_driver(&sc16is7xx_i2c_uart_driver);
+ #endif
++#endif
+ err_i2c:
+       uart_unregister_driver(&sc16is7xx_uart);
+       return ret;
index 9061911357440e4478693fe4e59aaa77e8967bf9..738a6560577c9a6aafed77e9115b8e9a395cf6bf 100644 (file)
@@ -38,3 +38,11 @@ revert-input-i8042-add-thinkpad-s230u-to-i8042-nomux-list.patch
 netfilter-nf_conntrack_pptp-fix-compilation-warning-with-w-1-build.patch
 mm-remove-vm_bug_on-pageslab-from-page_mapcount.patch
 drm-fb-helper-use-proper-plane-mask-for-fb-cleanup.patch
+genirq-generic_pending-do-not-lose-pending-affinity-update.patch
+usb-renesas_usbhs-gadget-fix-spin_lock_init-for-uep-lock.patch
+mac80211-fix-memory-leak.patch
+net-rtnl_configure_link-fix-dev-flags-changes-arg-to-__dev_notify_flags.patch
+mm-vmalloc.c-don-t-dereference-possible-null-pointer-in-__vunmap.patch
+asm-prototypes-clear-any-cpp-defines-before-declaring-the-functions.patch
+sc16is7xx-move-label-err_spi-to-correct-section.patch
+drm-msm-fix-possible-null-dereference-on-failure-of-get_pages.patch
diff --git a/queue-4.4/usb-renesas_usbhs-gadget-fix-spin_lock_init-for-uep-lock.patch b/queue-4.4/usb-renesas_usbhs-gadget-fix-spin_lock_init-for-uep-lock.patch
new file mode 100644 (file)
index 0000000..4635f5a
--- /dev/null
@@ -0,0 +1,47 @@
+From 14a8d4bfc2102f85ce097563d151370c91c1898a Mon Sep 17 00:00:00 2001
+From: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
+Date: Wed, 9 Aug 2017 19:55:24 +0900
+Subject: usb: renesas_usbhs: gadget: fix spin_lock_init() for &uep->lock
+
+From: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
+
+commit 14a8d4bfc2102f85ce097563d151370c91c1898a upstream.
+
+This patch fixes an issue that the spin_lock_init() is not called
+for almost all pipes. Otherwise, the lockdep output the following
+message when we connect a usb cable using g_ncm:
+
+ INFO: trying to register non-static key.
+ the code is fine but needs lockdep annotation.
+ turning off the locking correctness validator.
+
+Reported-by: Kazuya Mizuguchi <kazuya.mizuguchi.ks@renesas.com>
+Fixes: b8b9c974afee ("usb: renesas_usbhs: gadget: disable all eps when the driver stops")
+Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
+Tested-by: Kazuya Mizuguchi <kazuya.mizuguchi.ks@renesas.com>
+Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
+Cc: Guenter Roeck <linux@roeck-us.net>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/usb/renesas_usbhs/mod_gadget.c |    2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/drivers/usb/renesas_usbhs/mod_gadget.c
++++ b/drivers/usb/renesas_usbhs/mod_gadget.c
+@@ -1103,7 +1103,6 @@ int usbhs_mod_gadget_probe(struct usbhs_
+               ret = -ENOMEM;
+               goto usbhs_mod_gadget_probe_err_gpriv;
+       }
+-      spin_lock_init(&uep->lock);
+       gpriv->transceiver = usb_get_phy(USB_PHY_TYPE_UNDEFINED);
+       dev_info(dev, "%stransceiver found\n",
+@@ -1151,6 +1150,7 @@ int usbhs_mod_gadget_probe(struct usbhs_
+               uep->ep.name            = uep->ep_name;
+               uep->ep.ops             = &usbhsg_ep_ops;
+               INIT_LIST_HEAD(&uep->ep.ep_list);
++              spin_lock_init(&uep->lock);
+               /* init DCP */
+               if (usbhsg_is_dcp(uep)) {