<feed xmlns='http://www.w3.org/2005/Atom'>
<title>user/sven/linux.git, branch v4.1.42</title>
<subtitle>Linux Kernel
</subtitle>
<id>https://git.stealer.net/cgit.cgi/user/sven/linux.git/atom?h=v4.1.42</id>
<link rel='self' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/atom?h=v4.1.42'/>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/'/>
<updated>2017-06-29T14:55:48Z</updated>
<entry>
<title>Linux 4.1.42</title>
<updated>2017-06-29T14:55:48Z</updated>
<author>
<name>Sasha Levin</name>
<email>alexander.levin@verizon.com</email>
</author>
<published>2017-06-29T14:55:48Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=2ac51e21d8c50ca37fc9b5b9a9b4937c810b0d0a'/>
<id>urn:sha1:2ac51e21d8c50ca37fc9b5b9a9b4937c810b0d0a</id>
<content type='text'>
Signed-off-by: Sasha Levin &lt;alexander.levin@verizon.com&gt;
</content>
</entry>
<entry>
<title>mm: fix new crash in unmapped_area_topdown()</title>
<updated>2017-06-28T22:57:50Z</updated>
<author>
<name>Hugh Dickins</name>
<email>hughd@google.com</email>
</author>
<published>2017-06-20T09:10:44Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=dcda279dede75d5cb4e6af18ba90eb4ca1e813ee'/>
<id>urn:sha1:dcda279dede75d5cb4e6af18ba90eb4ca1e813ee</id>
<content type='text'>
[ Upstream commit f4cb767d76cf7ee72f97dd76f6cfa6c76a5edc89 ]

Trinity gets kernel BUG at mm/mmap.c:1963! in about 3 minutes of
mmap testing.  That's the VM_BUG_ON(gap_end &lt; gap_start) at the
end of unmapped_area_topdown().  Linus points out how MAP_FIXED
(which does not have to respect our stack guard gap intentions)
could result in gap_end below gap_start there.  Fix that, and
the similar case in its alternative, unmapped_area().

Cc: stable@vger.kernel.org
Fixes: 1be7107fbe18 ("mm: larger stack guard gap, between vmas")
Reported-by: Dave Jones &lt;davej@codemonkey.org.uk&gt;
Debugged-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
Signed-off-by: Hugh Dickins &lt;hughd@google.com&gt;
Acked-by: Michal Hocko &lt;mhocko@suse.com&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
Signed-off-by: Sasha Levin &lt;alexander.levin@verizon.com&gt;
</content>
</entry>
<entry>
<title>mm: larger stack guard gap, between vmas</title>
<updated>2017-06-28T22:57:15Z</updated>
<author>
<name>Sasha Levin</name>
<email>alexander.levin@verizon.com</email>
</author>
<published>2017-06-28T22:57:07Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=8b18c6b2a0dde5186ed83a60c4915c0909cbeb0a'/>
<id>urn:sha1:8b18c6b2a0dde5186ed83a60c4915c0909cbeb0a</id>
<content type='text'>
[ Upstream commit 1be7107fbe18eed3e319a6c3e83c78254b693acb ]

Stack guard page is a useful feature to reduce a risk of stack smashing
into a different mapping. We have been using a single page gap which
is sufficient to prevent having stack adjacent to a different mapping.
But this seems to be insufficient in the light of the stack usage in
userspace. E.g. glibc uses as large as 64kB alloca() in many commonly
used functions. Others use constructs liks gid_t buffer[NGROUPS_MAX]
which is 256kB or stack strings with MAX_ARG_STRLEN.

This will become especially dangerous for suid binaries and the default
no limit for the stack size limit because those applications can be
tricked to consume a large portion of the stack and a single glibc call
could jump over the guard page. These attacks are not theoretical,
unfortunatelly.

Make those attacks less probable by increasing the stack guard gap
to 1MB (on systems with 4k pages; but make it depend on the page size
because systems with larger base pages might cap stack allocations in
the PAGE_SIZE units) which should cover larger alloca() and VLA stack
allocations. It is obviously not a full fix because the problem is
somehow inherent, but it should reduce attack space a lot.

One could argue that the gap size should be configurable from userspace,
but that can be done later when somebody finds that the new 1MB is wrong
for some special case applications.  For now, add a kernel command line
option (stack_guard_gap) to specify the stack gap size (in page units).

Implementation wise, first delete all the old code for stack guard page:
because although we could get away with accounting one extra page in a
stack vma, accounting a larger gap can break userspace - case in point,
a program run with "ulimit -S -v 20000" failed when the 1MB gap was
counted for RLIMIT_AS; similar problems could come with RLIMIT_MLOCK
and strict non-overcommit mode.

Instead of keeping gap inside the stack vma, maintain the stack guard
gap as a gap between vmas: using vm_start_gap() in place of vm_start
(or vm_end_gap() in place of vm_end if VM_GROWSUP) in just those few
places which need to respect the gap - mainly arch_get_unmapped_area(),
and and the vma tree's subtree_gap support for that.

Original-patch-by: Oleg Nesterov &lt;oleg@redhat.com&gt;
Original-patch-by: Michal Hocko &lt;mhocko@suse.com&gt;
Signed-off-by: Hugh Dickins &lt;hughd@google.com&gt;
Acked-by: Michal Hocko &lt;mhocko@suse.com&gt;
Tested-by: Helge Deller &lt;deller@gmx.de&gt; # parisc
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
Signed-off-by: Sasha Levin &lt;alexander.levin@verizon.com&gt;
</content>
</entry>
<entry>
<title>alarmtimer: Rate limit periodic intervals</title>
<updated>2017-06-26T02:02:22Z</updated>
<author>
<name>Thomas Gleixner</name>
<email>tglx@linutronix.de</email>
</author>
<published>2017-05-30T21:15:35Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=55e6060ddd5fffa6f9baedd28e847afab84b5a2d'/>
<id>urn:sha1:55e6060ddd5fffa6f9baedd28e847afab84b5a2d</id>
<content type='text'>
[ Upstream commit ff86bf0c65f14346bf2440534f9ba5ac232c39a0 ]

The alarmtimer code has another source of potentially rearming itself too
fast. Interval timers with a very samll interval have a similar CPU hog
effect as the previously fixed overflow issue.

The reason is that alarmtimers do not implement the normal protection
against this kind of problem which the other posix timer use:

  timer expires -&gt; queue signal -&gt; deliver signal -&gt; rearm timer

This scheme brings the rearming under scheduler control and prevents
permanently firing timers which hog the CPU.

Bringing this scheme to the alarm timer code is a major overhaul because it
lacks all the necessary mechanisms completely.

So for a quick fix limit the interval to one jiffie. This is not
problematic in practice as alarmtimers are usually backed by an RTC for
suspend which have 1 second resolution. It could be therefor argued that
the resolution of this clock should be set to 1 second in general, but
that's outside the scope of this fix.

Signed-off-by: Thomas Gleixner &lt;tglx@linutronix.de&gt;
Cc: Peter Zijlstra &lt;peterz@infradead.org&gt;
Cc: Kostya Serebryany &lt;kcc@google.com&gt;
Cc: syzkaller &lt;syzkaller@googlegroups.com&gt;
Cc: John Stultz &lt;john.stultz@linaro.org&gt;
Cc: Dmitry Vyukov &lt;dvyukov@google.com&gt;
Cc: stable@vger.kernel.org
Link: http://lkml.kernel.org/r/20170530211655.896767100@linutronix.de
Signed-off-by: Sasha Levin &lt;alexander.levin@verizon.com&gt;
</content>
</entry>
<entry>
<title>MIPS: Fix bnezc/jialc return address calculation</title>
<updated>2017-06-26T02:02:22Z</updated>
<author>
<name>Paul Burton</name>
<email>paul.burton@imgtec.com</email>
</author>
<published>2017-06-02T18:35:01Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=cedbfb3dc38c128f7541a5e6050862ee038e7583'/>
<id>urn:sha1:cedbfb3dc38c128f7541a5e6050862ee038e7583</id>
<content type='text'>
[ Upstream commit 1a73d9310e093fc3adffba4d0a67b9fab2ee3f63 ]

The code handling the pop76 opcode (ie. bnezc &amp; jialc instructions) in
__compute_return_epc_for_insn() needs to set the value of $31 in the
jialc case, which is encoded with rs = 0. However its check to
differentiate bnezc (rs != 0) from jialc (rs = 0) was unfortunately
backwards, meaning that if we emulate a bnezc instruction we clobber $31
&amp; if we emulate a jialc instruction it actually behaves like a jic
instruction.

Fix this by inverting the check of rs to match the way the instructions
are actually encoded.

Signed-off-by: Paul Burton &lt;paul.burton@imgtec.com&gt;
Fixes: 28d6f93d201d ("MIPS: Emulate the new MIPS R6 BNEZC and JIALC instructions")
Cc: stable &lt;stable@vger.kernel.org&gt; # v4.0+
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/16178/
Signed-off-by: Ralf Baechle &lt;ralf@linux-mips.org&gt;
Signed-off-by: Sasha Levin &lt;alexander.levin@verizon.com&gt;
</content>
</entry>
<entry>
<title>usb: dwc3: exynos fix axius clock error path to do cleanup</title>
<updated>2017-06-26T02:02:22Z</updated>
<author>
<name>Shuah Khan</name>
<email>shuahkh@osg.samsung.com</email>
</author>
<published>2017-01-10T23:05:28Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=d490b0caf87fa4d743b6cc2c00a16aa1f84d2c74'/>
<id>urn:sha1:d490b0caf87fa4d743b6cc2c00a16aa1f84d2c74</id>
<content type='text'>
[ Upstream commit 8ae584d1951f241efd45499f8774fd7066f22823 ]

Axius clock error path returns without disabling clock and suspend clock.
Fix it to disable them before returning error.

Reviewed-by: Javier Martinez Canillas &lt;javier@osg.samsung.com&gt;
Signed-off-by: Shuah Khan &lt;shuahkh@osg.samsung.com&gt;
Signed-off-by: Felipe Balbi &lt;felipe.balbi@linux.intel.com&gt;
Signed-off-by: Sasha Levin &lt;alexander.levin@verizon.com&gt;
</content>
</entry>
<entry>
<title>genirq: Release resources in __setup_irq() error path</title>
<updated>2017-06-26T02:02:22Z</updated>
<author>
<name>Heiner Kallweit</name>
<email>hkallweit1@gmail.com</email>
</author>
<published>2017-06-10T22:38:36Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=61e04a644bd8f083e8c6354dae187a672b0e8f90'/>
<id>urn:sha1:61e04a644bd8f083e8c6354dae187a672b0e8f90</id>
<content type='text'>
[ Upstream commit fa07ab72cbb0d843429e61bf179308aed6cbe0dd ]

In case __irq_set_trigger() fails the resources requested via
irq_request_resources() are not released.

Add the missing release call into the error handling path.

Fixes: c1bacbae8192 ("genirq: Provide irq_request/release_resources chip callbacks")
Signed-off-by: Heiner Kallweit &lt;hkallweit1@gmail.com&gt;
Signed-off-by: Thomas Gleixner &lt;tglx@linutronix.de&gt;
Cc: stable@vger.kernel.org
Link: http://lkml.kernel.org/r/655538f5-cb20-a892-ff15-fbd2dd1fa4ec@gmail.com
Signed-off-by: Sasha Levin &lt;alexander.levin@verizon.com&gt;
</content>
</entry>
<entry>
<title>swap: cond_resched in swap_cgroup_prepare()</title>
<updated>2017-06-26T02:02:22Z</updated>
<author>
<name>Yu Zhao</name>
<email>yuzhao@google.com</email>
</author>
<published>2017-06-16T21:02:31Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=ec8376b633c9cef45790bf5b2cee7fe6d319748a'/>
<id>urn:sha1:ec8376b633c9cef45790bf5b2cee7fe6d319748a</id>
<content type='text'>
[ Upstream commit ef70762948dde012146926720b70e79736336764 ]

I saw need_resched() warnings when swapping on large swapfile (TBs)
because continuously allocating many pages in swap_cgroup_prepare() took
too long.

We already cond_resched when freeing page in swap_cgroup_swapoff().  Do
the same for the page allocation.

Link: http://lkml.kernel.org/r/20170604200109.17606-1-yuzhao@google.com
Signed-off-by: Yu Zhao &lt;yuzhao@google.com&gt;
Acked-by: Michal Hocko &lt;mhocko@suse.com&gt;
Acked-by: Vladimir Davydov &lt;vdavydov.dev@gmail.com&gt;
Cc: &lt;stable@vger.kernel.org&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
Signed-off-by: Sasha Levin &lt;alexander.levin@verizon.com&gt;
</content>
</entry>
<entry>
<title>mm/memory-failure.c: use compound_head() flags for huge pages</title>
<updated>2017-06-26T02:02:22Z</updated>
<author>
<name>James Morse</name>
<email>james.morse@arm.com</email>
</author>
<published>2017-06-16T21:02:29Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=331720703ebb8efe1e697f2672f9a6f942cc7fd0'/>
<id>urn:sha1:331720703ebb8efe1e697f2672f9a6f942cc7fd0</id>
<content type='text'>
[ Upstream commit 7258ae5c5a2ce2f5969e8b18b881be40ab55433d ]

memory_failure() chooses a recovery action function based on the page
flags.  For huge pages it uses the tail page flags which don't have
anything interesting set, resulting in:

&gt; Memory failure: 0x9be3b4: Unknown page state
&gt; Memory failure: 0x9be3b4: recovery action for unknown page: Failed

Instead, save a copy of the head page's flags if this is a huge page,
this means if there are no relevant flags for this tail page, we use the
head pages flags instead.  This results in the me_huge_page() recovery
action being called:

&gt; Memory failure: 0x9b7969: recovery action for huge page: Delayed

For hugepages that have not yet been allocated, this allows the hugepage
to be dequeued.

Fixes: 524fca1e7356 ("HWPOISON: fix misjudgement of page_action() for errors on mlocked pages")
Link: http://lkml.kernel.org/r/20170524130204.21845-1-james.morse@arm.com
Signed-off-by: James Morse &lt;james.morse@arm.com&gt;
Tested-by: Punit Agrawal &lt;punit.agrawal@arm.com&gt;
Acked-by: Punit Agrawal &lt;punit.agrawal@arm.com&gt;
Acked-by: Naoya Horiguchi &lt;n-horiguchi@ah.jp.nec.com&gt;
Cc: &lt;stable@vger.kernel.org&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
Signed-off-by: Sasha Levin &lt;alexander.levin@verizon.com&gt;
</content>
</entry>
<entry>
<title>USB: gadgetfs, dummy-hcd, net2280: fix locking for callbacks</title>
<updated>2017-06-26T02:02:22Z</updated>
<author>
<name>Alan Stern</name>
<email>stern@rowland.harvard.edu</email>
</author>
<published>2017-06-13T19:23:42Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=e2884056685388d261108765303fb3a291f05b2c'/>
<id>urn:sha1:e2884056685388d261108765303fb3a291f05b2c</id>
<content type='text'>
[ Upstream commit f16443a034c7aa359ddf6f0f9bc40d01ca31faea ]

Using the syzkaller kernel fuzzer, Andrey Konovalov generated the
following error in gadgetfs:

&gt; BUG: KASAN: use-after-free in __lock_acquire+0x3069/0x3690
&gt; kernel/locking/lockdep.c:3246
&gt; Read of size 8 at addr ffff88003a2bdaf8 by task kworker/3:1/903
&gt;
&gt; CPU: 3 PID: 903 Comm: kworker/3:1 Not tainted 4.12.0-rc4+ #35
&gt; Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Bochs 01/01/2011
&gt; Workqueue: usb_hub_wq hub_event
&gt; Call Trace:
&gt;  __dump_stack lib/dump_stack.c:16 [inline]
&gt;  dump_stack+0x292/0x395 lib/dump_stack.c:52
&gt;  print_address_description+0x78/0x280 mm/kasan/report.c:252
&gt;  kasan_report_error mm/kasan/report.c:351 [inline]
&gt;  kasan_report+0x230/0x340 mm/kasan/report.c:408
&gt;  __asan_report_load8_noabort+0x19/0x20 mm/kasan/report.c:429
&gt;  __lock_acquire+0x3069/0x3690 kernel/locking/lockdep.c:3246
&gt;  lock_acquire+0x22d/0x560 kernel/locking/lockdep.c:3855
&gt;  __raw_spin_lock include/linux/spinlock_api_smp.h:142 [inline]
&gt;  _raw_spin_lock+0x2f/0x40 kernel/locking/spinlock.c:151
&gt;  spin_lock include/linux/spinlock.h:299 [inline]
&gt;  gadgetfs_suspend+0x89/0x130 drivers/usb/gadget/legacy/inode.c:1682
&gt;  set_link_state+0x88e/0xae0 drivers/usb/gadget/udc/dummy_hcd.c:455
&gt;  dummy_hub_control+0xd7e/0x1fb0 drivers/usb/gadget/udc/dummy_hcd.c:2074
&gt;  rh_call_control drivers/usb/core/hcd.c:689 [inline]
&gt;  rh_urb_enqueue drivers/usb/core/hcd.c:846 [inline]
&gt;  usb_hcd_submit_urb+0x92f/0x20b0 drivers/usb/core/hcd.c:1650
&gt;  usb_submit_urb+0x8b2/0x12c0 drivers/usb/core/urb.c:542
&gt;  usb_start_wait_urb+0x148/0x5b0 drivers/usb/core/message.c:56
&gt;  usb_internal_control_msg drivers/usb/core/message.c:100 [inline]
&gt;  usb_control_msg+0x341/0x4d0 drivers/usb/core/message.c:151
&gt;  usb_clear_port_feature+0x74/0xa0 drivers/usb/core/hub.c:412
&gt;  hub_port_disable+0x123/0x510 drivers/usb/core/hub.c:4177
&gt;  hub_port_init+0x1ed/0x2940 drivers/usb/core/hub.c:4648
&gt;  hub_port_connect drivers/usb/core/hub.c:4826 [inline]
&gt;  hub_port_connect_change drivers/usb/core/hub.c:4999 [inline]
&gt;  port_event drivers/usb/core/hub.c:5105 [inline]
&gt;  hub_event+0x1ae1/0x3d40 drivers/usb/core/hub.c:5185
&gt;  process_one_work+0xc08/0x1bd0 kernel/workqueue.c:2097
&gt;  process_scheduled_works kernel/workqueue.c:2157 [inline]
&gt;  worker_thread+0xb2b/0x1860 kernel/workqueue.c:2233
&gt;  kthread+0x363/0x440 kernel/kthread.c:231
&gt;  ret_from_fork+0x2a/0x40 arch/x86/entry/entry_64.S:424
&gt;
&gt; Allocated by task 9958:
&gt;  save_stack_trace+0x1b/0x20 arch/x86/kernel/stacktrace.c:59
&gt;  save_stack+0x43/0xd0 mm/kasan/kasan.c:513
&gt;  set_track mm/kasan/kasan.c:525 [inline]
&gt;  kasan_kmalloc+0xad/0xe0 mm/kasan/kasan.c:617
&gt;  kmem_cache_alloc_trace+0x87/0x280 mm/slub.c:2745
&gt;  kmalloc include/linux/slab.h:492 [inline]
&gt;  kzalloc include/linux/slab.h:665 [inline]
&gt;  dev_new drivers/usb/gadget/legacy/inode.c:170 [inline]
&gt;  gadgetfs_fill_super+0x24f/0x540 drivers/usb/gadget/legacy/inode.c:1993
&gt;  mount_single+0xf6/0x160 fs/super.c:1192
&gt;  gadgetfs_mount+0x31/0x40 drivers/usb/gadget/legacy/inode.c:2019
&gt;  mount_fs+0x9c/0x2d0 fs/super.c:1223
&gt;  vfs_kern_mount.part.25+0xcb/0x490 fs/namespace.c:976
&gt;  vfs_kern_mount fs/namespace.c:2509 [inline]
&gt;  do_new_mount fs/namespace.c:2512 [inline]
&gt;  do_mount+0x41b/0x2d90 fs/namespace.c:2834
&gt;  SYSC_mount fs/namespace.c:3050 [inline]
&gt;  SyS_mount+0xb0/0x120 fs/namespace.c:3027
&gt;  entry_SYSCALL_64_fastpath+0x1f/0xbe
&gt;
&gt; Freed by task 9960:
&gt;  save_stack_trace+0x1b/0x20 arch/x86/kernel/stacktrace.c:59
&gt;  save_stack+0x43/0xd0 mm/kasan/kasan.c:513
&gt;  set_track mm/kasan/kasan.c:525 [inline]
&gt;  kasan_slab_free+0x72/0xc0 mm/kasan/kasan.c:590
&gt;  slab_free_hook mm/slub.c:1357 [inline]
&gt;  slab_free_freelist_hook mm/slub.c:1379 [inline]
&gt;  slab_free mm/slub.c:2961 [inline]
&gt;  kfree+0xed/0x2b0 mm/slub.c:3882
&gt;  put_dev+0x124/0x160 drivers/usb/gadget/legacy/inode.c:163
&gt;  gadgetfs_kill_sb+0x33/0x60 drivers/usb/gadget/legacy/inode.c:2027
&gt;  deactivate_locked_super+0x8d/0xd0 fs/super.c:309
&gt;  deactivate_super+0x21e/0x310 fs/super.c:340
&gt;  cleanup_mnt+0xb7/0x150 fs/namespace.c:1112
&gt;  __cleanup_mnt+0x1b/0x20 fs/namespace.c:1119
&gt;  task_work_run+0x1a0/0x280 kernel/task_work.c:116
&gt;  exit_task_work include/linux/task_work.h:21 [inline]
&gt;  do_exit+0x18a8/0x2820 kernel/exit.c:878
&gt;  do_group_exit+0x14e/0x420 kernel/exit.c:982
&gt;  get_signal+0x784/0x1780 kernel/signal.c:2318
&gt;  do_signal+0xd7/0x2130 arch/x86/kernel/signal.c:808
&gt;  exit_to_usermode_loop+0x1ac/0x240 arch/x86/entry/common.c:157
&gt;  prepare_exit_to_usermode arch/x86/entry/common.c:194 [inline]
&gt;  syscall_return_slowpath+0x3ba/0x410 arch/x86/entry/common.c:263
&gt;  entry_SYSCALL_64_fastpath+0xbc/0xbe
&gt;
&gt; The buggy address belongs to the object at ffff88003a2bdae0
&gt;  which belongs to the cache kmalloc-1024 of size 1024
&gt; The buggy address is located 24 bytes inside of
&gt;  1024-byte region [ffff88003a2bdae0, ffff88003a2bdee0)
&gt; The buggy address belongs to the page:
&gt; page:ffffea0000e8ae00 count:1 mapcount:0 mapping:          (null)
&gt; index:0x0 compound_mapcount: 0
&gt; flags: 0x100000000008100(slab|head)
&gt; raw: 0100000000008100 0000000000000000 0000000000000000 0000000100170017
&gt; raw: ffffea0000ed3020 ffffea0000f5f820 ffff88003e80efc0 0000000000000000
&gt; page dumped because: kasan: bad access detected
&gt;
&gt; Memory state around the buggy address:
&gt;  ffff88003a2bd980: fb fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
&gt;  ffff88003a2bda00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
&gt; &gt;ffff88003a2bda80: fc fc fc fc fc fc fc fc fc fc fc fc fb fb fb fb
&gt;                                                                 ^
&gt;  ffff88003a2bdb00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
&gt;  ffff88003a2bdb80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
&gt; ==================================================================

What this means is that the gadgetfs_suspend() routine was trying to
access dev-&gt;lock after it had been deallocated.  The root cause is a
race in the dummy_hcd driver; the dummy_udc_stop() routine can race
with the rest of the driver because it contains no locking.  And even
when proper locking is added, it can still race with the
set_link_state() function because that function incorrectly drops the
private spinlock before invoking any gadget driver callbacks.

The result of this race, as seen above, is that set_link_state() can
invoke a callback in gadgetfs even after gadgetfs has been unbound
from dummy_hcd's UDC and its private data structures have been
deallocated.

include/linux/usb/gadget.h documents that the -&gt;reset, -&gt;disconnect,
-&gt;suspend, and -&gt;resume callbacks may be invoked in interrupt context.
In general this is necessary, to prevent races with gadget driver
removal.  This patch fixes dummy_hcd to retain the spinlock across
these calls, and it adds a spinlock acquisition to dummy_udc_stop() to
prevent the race.

The net2280 driver makes the same mistake of dropping the private
spinlock for its -&gt;disconnect and -&gt;reset callback invocations.  The
patch fixes it too.

Lastly, since gadgetfs_suspend() may be invoked in interrupt context,
it cannot assume that interrupts are enabled when it runs.  It must
use spin_lock_irqsave() instead of spin_lock_irq().  The patch fixes
that bug as well.

Signed-off-by: Alan Stern &lt;stern@rowland.harvard.edu&gt;
Reported-and-tested-by: Andrey Konovalov &lt;andreyknvl@google.com&gt;
CC: &lt;stable@vger.kernel.org&gt;
Acked-by: Felipe Balbi &lt;felipe.balbi@linux.intel.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
Signed-off-by: Sasha Levin &lt;alexander.levin@verizon.com&gt;
</content>
</entry>
</feed>
