syzbot


memory leak in gadget_setup

Status: fixed on 2020/11/20 14:54
Subsystems: usb
[Documentation on labels]
Reported-by: syzbot+bd38200f53df6259e6bf@syzkaller.appspotmail.com
Fix commit: 129aa9734559 usb: raw-gadget: fix memory leak in gadget_setup
First crash: 1270d, last: 1251d
Discussions (4)
Title Replies (including bot) Last reply
[PATCH 5.9 000/255] 5.9.9-rc1 review 264 (264) 2020/11/19 12:14
[PATCH AUTOSEL 5.9 01/55] ASoC: mediatek: mt8183-da7219: fix DAPM paths for rt1015 61 (61) 2020/11/13 22:40
[PATCH] usb: raw-gadget: fix memory leak in gadget_setup 1 (1) 2020/10/27 07:30
memory leak in gadget_setup 0 (1) 2020/10/23 15:26

Sample crash report:
BUG: memory leak
unreferenced object 0xffff88810da600c0 (size 32):
  comm "softirq", pid 0, jiffies 4294941699 (age 14.890s)
  hex dump (first 32 bytes):
    02 00 00 00 08 00 00 00 80 06 00 01 00 00 12 00  ................
    00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
  backtrace:
    [<0000000079e8599a>] kmalloc include/linux/slab.h:552 [inline]
    [<0000000079e8599a>] raw_event_queue_add drivers/usb/gadget/legacy/raw_gadget.c:66 [inline]
    [<0000000079e8599a>] raw_queue_event drivers/usb/gadget/legacy/raw_gadget.c:225 [inline]
    [<0000000079e8599a>] gadget_setup+0xf6/0x220 drivers/usb/gadget/legacy/raw_gadget.c:343
    [<00000000c658c035>] dummy_timer+0xb9f/0x14c0 drivers/usb/gadget/udc/dummy_hcd.c:1899
    [<00000000d3ba723d>] call_timer_fn+0x38/0x200 kernel/time/timer.c:1410
    [<00000000de9fc504>] expire_timers kernel/time/timer.c:1455 [inline]
    [<00000000de9fc504>] __run_timers.part.0+0x319/0x400 kernel/time/timer.c:1747
    [<00000000ba46b800>] __run_timers kernel/time/timer.c:1728 [inline]
    [<00000000ba46b800>] run_timer_softirq+0x3d/0x80 kernel/time/timer.c:1760
    [<00000000c3214a31>] __do_softirq+0xcc/0x2c2 kernel/softirq.c:298
    [<0000000093e6487f>] asm_call_irq_on_stack+0xf/0x20
    [<00000000ed5ecf79>] __run_on_irqstack arch/x86/include/asm/irq_stack.h:26 [inline]
    [<00000000ed5ecf79>] run_on_irqstack_cond arch/x86/include/asm/irq_stack.h:77 [inline]
    [<00000000ed5ecf79>] do_softirq_own_stack+0x32/0x40 arch/x86/kernel/irq_64.c:77
    [<00000000e57f9be6>] invoke_softirq kernel/softirq.c:393 [inline]
    [<00000000e57f9be6>] __irq_exit_rcu kernel/softirq.c:423 [inline]
    [<00000000e57f9be6>] irq_exit_rcu+0x91/0xc0 kernel/softirq.c:435
    [<00000000d32abe07>] sysvec_apic_timer_interrupt+0x36/0x80 arch/x86/kernel/apic/apic.c:1091
    [<0000000000c760e3>] asm_sysvec_apic_timer_interrupt+0x12/0x20 arch/x86/include/asm/idtentry.h:631
    [<00000000a99832b7>] native_safe_halt arch/x86/include/asm/irqflags.h:60 [inline]
    [<00000000a99832b7>] arch_safe_halt arch/x86/include/asm/irqflags.h:103 [inline]
    [<00000000a99832b7>] acpi_safe_halt drivers/acpi/processor_idle.c:111 [inline]
    [<00000000a99832b7>] acpi_idle_do_entry+0xc3/0xd0 drivers/acpi/processor_idle.c:517
    [<0000000024c59c54>] acpi_idle_enter+0x128/0x1f0 drivers/acpi/processor_idle.c:648
    [<000000004380cc43>] cpuidle_enter_state+0xc9/0x650 drivers/cpuidle/cpuidle.c:237
    [<00000000b0110882>] cpuidle_enter+0x29/0x40 drivers/cpuidle/cpuidle.c:351
    [<0000000031ca91e8>] call_cpuidle kernel/sched/idle.c:132 [inline]
    [<0000000031ca91e8>] cpuidle_idle_call kernel/sched/idle.c:213 [inline]
    [<0000000031ca91e8>] do_idle+0x1c8/0x250 kernel/sched/idle.c:273

BUG: memory leak
unreferenced object 0xffff888111075080 (size 32):
  comm "softirq", pid 0, jiffies 4294941703 (age 14.850s)
  hex dump (first 32 bytes):
    02 00 00 00 08 00 00 00 80 06 00 02 00 00 09 00  ................
    00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
  backtrace:
    [<0000000079e8599a>] kmalloc include/linux/slab.h:552 [inline]
    [<0000000079e8599a>] raw_event_queue_add drivers/usb/gadget/legacy/raw_gadget.c:66 [inline]
    [<0000000079e8599a>] raw_queue_event drivers/usb/gadget/legacy/raw_gadget.c:225 [inline]
    [<0000000079e8599a>] gadget_setup+0xf6/0x220 drivers/usb/gadget/legacy/raw_gadget.c:343
    [<00000000c658c035>] dummy_timer+0xb9f/0x14c0 drivers/usb/gadget/udc/dummy_hcd.c:1899
    [<00000000d3ba723d>] call_timer_fn+0x38/0x200 kernel/time/timer.c:1410
    [<00000000de9fc504>] expire_timers kernel/time/timer.c:1455 [inline]
    [<00000000de9fc504>] __run_timers.part.0+0x319/0x400 kernel/time/timer.c:1747
    [<00000000ba46b800>] __run_timers kernel/time/timer.c:1728 [inline]
    [<00000000ba46b800>] run_timer_softirq+0x3d/0x80 kernel/time/timer.c:1760
    [<00000000c3214a31>] __do_softirq+0xcc/0x2c2 kernel/softirq.c:298
    [<0000000093e6487f>] asm_call_irq_on_stack+0xf/0x20
    [<00000000ed5ecf79>] __run_on_irqstack arch/x86/include/asm/irq_stack.h:26 [inline]
    [<00000000ed5ecf79>] run_on_irqstack_cond arch/x86/include/asm/irq_stack.h:77 [inline]
    [<00000000ed5ecf79>] do_softirq_own_stack+0x32/0x40 arch/x86/kernel/irq_64.c:77
    [<00000000e57f9be6>] invoke_softirq kernel/softirq.c:393 [inline]
    [<00000000e57f9be6>] __irq_exit_rcu kernel/softirq.c:423 [inline]
    [<00000000e57f9be6>] irq_exit_rcu+0x91/0xc0 kernel/softirq.c:435
    [<00000000d32abe07>] sysvec_apic_timer_interrupt+0x36/0x80 arch/x86/kernel/apic/apic.c:1091
    [<0000000000c760e3>] asm_sysvec_apic_timer_interrupt+0x12/0x20 arch/x86/include/asm/idtentry.h:631
    [<00000000a99832b7>] native_safe_halt arch/x86/include/asm/irqflags.h:60 [inline]
    [<00000000a99832b7>] arch_safe_halt arch/x86/include/asm/irqflags.h:103 [inline]
    [<00000000a99832b7>] acpi_safe_halt drivers/acpi/processor_idle.c:111 [inline]
    [<00000000a99832b7>] acpi_idle_do_entry+0xc3/0xd0 drivers/acpi/processor_idle.c:517
    [<0000000024c59c54>] acpi_idle_enter+0x128/0x1f0 drivers/acpi/processor_idle.c:648
    [<000000004380cc43>] cpuidle_enter_state+0xc9/0x650 drivers/cpuidle/cpuidle.c:237
    [<00000000b0110882>] cpuidle_enter+0x29/0x40 drivers/cpuidle/cpuidle.c:351
    [<0000000031ca91e8>] call_cpuidle kernel/sched/idle.c:132 [inline]
    [<0000000031ca91e8>] cpuidle_idle_call kernel/sched/idle.c:213 [inline]
    [<0000000031ca91e8>] do_idle+0x1c8/0x250 kernel/sched/idle.c:273

BUG: memory leak
unreferenced object 0xffff88810da60d40 (size 32):
  comm "softirq", pid 0, jiffies 4294941707 (age 14.810s)
  hex dump (first 32 bytes):
    02 00 00 00 08 00 00 00 80 06 00 02 00 00 12 00  ................
    00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
  backtrace:
    [<0000000079e8599a>] kmalloc include/linux/slab.h:552 [inline]
    [<0000000079e8599a>] raw_event_queue_add drivers/usb/gadget/legacy/raw_gadget.c:66 [inline]
    [<0000000079e8599a>] raw_queue_event drivers/usb/gadget/legacy/raw_gadget.c:225 [inline]
    [<0000000079e8599a>] gadget_setup+0xf6/0x220 drivers/usb/gadget/legacy/raw_gadget.c:343
    [<00000000c658c035>] dummy_timer+0xb9f/0x14c0 drivers/usb/gadget/udc/dummy_hcd.c:1899
    [<00000000d3ba723d>] call_timer_fn+0x38/0x200 kernel/time/timer.c:1410
    [<00000000de9fc504>] expire_timers kernel/time/timer.c:1455 [inline]
    [<00000000de9fc504>] __run_timers.part.0+0x319/0x400 kernel/time/timer.c:1747
    [<00000000ba46b800>] __run_timers kernel/time/timer.c:1728 [inline]
    [<00000000ba46b800>] run_timer_softirq+0x3d/0x80 kernel/time/timer.c:1760
    [<00000000c3214a31>] __do_softirq+0xcc/0x2c2 kernel/softirq.c:298
    [<0000000093e6487f>] asm_call_irq_on_stack+0xf/0x20
    [<00000000ed5ecf79>] __run_on_irqstack arch/x86/include/asm/irq_stack.h:26 [inline]
    [<00000000ed5ecf79>] run_on_irqstack_cond arch/x86/include/asm/irq_stack.h:77 [inline]
    [<00000000ed5ecf79>] do_softirq_own_stack+0x32/0x40 arch/x86/kernel/irq_64.c:77
    [<00000000e57f9be6>] invoke_softirq kernel/softirq.c:393 [inline]
    [<00000000e57f9be6>] __irq_exit_rcu kernel/softirq.c:423 [inline]
    [<00000000e57f9be6>] irq_exit_rcu+0x91/0xc0 kernel/softirq.c:435
    [<00000000d32abe07>] sysvec_apic_timer_interrupt+0x36/0x80 arch/x86/kernel/apic/apic.c:1091
    [<0000000000c760e3>] asm_sysvec_apic_timer_interrupt+0x12/0x20 arch/x86/include/asm/idtentry.h:631
    [<00000000a99832b7>] native_safe_halt arch/x86/include/asm/irqflags.h:60 [inline]
    [<00000000a99832b7>] arch_safe_halt arch/x86/include/asm/irqflags.h:103 [inline]
    [<00000000a99832b7>] acpi_safe_halt drivers/acpi/processor_idle.c:111 [inline]
    [<00000000a99832b7>] acpi_idle_do_entry+0xc3/0xd0 drivers/acpi/processor_idle.c:517
    [<0000000024c59c54>] acpi_idle_enter+0x128/0x1f0 drivers/acpi/processor_idle.c:648
    [<000000004380cc43>] cpuidle_enter_state+0xc9/0x650 drivers/cpuidle/cpuidle.c:237
    [<00000000b0110882>] cpuidle_enter+0x29/0x40 drivers/cpuidle/cpuidle.c:351
    [<0000000031ca91e8>] call_cpuidle kernel/sched/idle.c:132 [inline]
    [<0000000031ca91e8>] cpuidle_idle_call kernel/sched/idle.c:213 [inline]
    [<0000000031ca91e8>] do_idle+0x1c8/0x250 kernel/sched/idle.c:273


Crashes (49):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2020/11/09 07:48 upstream 9dbc1c03eeb5 64069d48 .config console log report syz C ci-upstream-gce-leak
2020/11/08 23:02 upstream 9dbc1c03eeb5 64069d48 .config console log report syz C ci-upstream-gce-leak
2020/11/08 22:15 upstream 9dbc1c03eeb5 64069d48 .config console log report syz C ci-upstream-gce-leak
2020/11/08 05:32 upstream 4429f14aeea9 64069d48 .config console log report syz C ci-upstream-gce-leak
2020/11/08 05:15 upstream 4429f14aeea9 64069d48 .config console log report syz C ci-upstream-gce-leak
2020/11/08 05:03 upstream 4429f14aeea9 64069d48 .config console log report syz C ci-upstream-gce-leak
2020/11/08 04:34 upstream 4429f14aeea9 64069d48 .config console log report syz C ci-upstream-gce-leak
2020/11/07 15:35 upstream 659caaf65dc9 64069d48 .config console log report syz C ci-upstream-gce-leak
2020/11/07 15:12 upstream 659caaf65dc9 64069d48 .config console log report syz C ci-upstream-gce-leak
2020/11/07 12:13 upstream bf3e76289cd2 64069d48 .config console log report syz C ci-upstream-gce-leak
2020/11/07 10:28 upstream bf3e76289cd2 64069d48 .config console log report syz C ci-upstream-gce-leak
2020/11/07 07:25 upstream bf3e76289cd2 64069d48 .config console log report syz C ci-upstream-gce-leak
2020/11/07 01:25 upstream bf3e76289cd2 64069d48 .config console log report syz C ci-upstream-gce-leak
2020/11/05 20:55 upstream 4ef8451b3326 64069d48 .config console log report syz C ci-upstream-gce-leak
2020/11/05 16:32 upstream 4ef8451b3326 64069d48 .config console log report syz C ci-upstream-gce-leak
2020/11/05 03:37 upstream 4ef8451b3326 64069d48 .config console log report syz C ci-upstream-gce-leak
2020/11/02 08:35 upstream 3cea11cd5e3b 8bc4594f .config console log report syz C ci-upstream-gce-leak
2020/11/02 03:55 upstream 3cea11cd5e3b 8bc4594f .config console log report syz C ci-upstream-gce-leak
2020/11/02 03:37 upstream 3cea11cd5e3b 8bc4594f .config console log report syz C ci-upstream-gce-leak
2020/11/01 20:53 upstream c2dc4c073fb7 8bc4594f .config console log report syz C ci-upstream-gce-leak
2020/11/01 16:51 upstream c2dc4c073fb7 8bc4594f .config console log report syz C ci-upstream-gce-leak
2020/11/01 05:56 upstream bb3540be73ca 8bc4594f .config console log report syz C ci-upstream-gce-leak
2020/11/01 00:02 upstream bb3540be73ca 8bc4594f .config console log report syz C ci-upstream-gce-leak
2020/10/30 13:31 upstream 07e088730245 a6e3ac3b .config console log report syz C ci-upstream-gce-leak
2020/10/29 13:01 upstream 23859ae44402 f24824d3 .config console log report syz C ci-upstream-gce-leak
2020/10/29 09:06 upstream 23859ae44402 f24824d3 .config console log report syz C ci-upstream-gce-leak
2020/10/29 08:45 upstream 23859ae44402 f24824d3 .config console log report syz C ci-upstream-gce-leak
2020/10/28 19:43 upstream ed8780e3f2ec f24824d3 .config console log report syz C ci-upstream-gce-leak
2020/10/28 00:39 upstream 8c2ab803e565 96e03c1c .config console log report syz C ci-upstream-gce-leak
2020/10/28 00:26 upstream 8c2ab803e565 96e03c1c .config console log report syz C ci-upstream-gce-leak
2020/10/28 00:25 upstream 8c2ab803e565 96e03c1c .config console log report syz C ci-upstream-gce-leak
2020/10/27 12:11 upstream 4525c8781ec0 94942294 .config console log report syz C ci-upstream-gce-leak
2020/10/27 01:38 upstream 41ba50b0572e 8b3eaf58 .config console log report syz C ci-upstream-gce-leak
2020/10/26 21:32 upstream 3650b228f83a a7aac492 .config console log report syz C ci-upstream-gce-leak
2020/10/26 15:48 upstream 3650b228f83a a7aac492 .config console log report syz C ci-upstream-gce-leak
2020/10/26 00:35 upstream 672f88712615 a1839e81 .config console log report syz C ci-upstream-gce-leak
2020/10/24 12:52 upstream f11901ed723d a1839e81 .config console log report syz C ci-upstream-gce-leak
2020/10/24 10:45 upstream f11901ed723d 2bb6666c .config console log report syz C ci-upstream-gce-leak
2020/10/23 22:01 upstream 0adc313c4f20 2bb6666c .config console log report syz C ci-upstream-gce-leak
2020/10/23 21:09 upstream 0adc313c4f20 2bb6666c .config console log report syz C ci-upstream-gce-leak
2020/10/23 16:12 upstream f9893351acae 4e740c00 .config console log report syz C ci-upstream-gce-leak
2020/10/23 15:52 upstream f9893351acae 4e740c00 .config console log report syz C ci-upstream-gce-leak
2020/10/23 15:39 upstream f9893351acae 4e740c00 .config console log report syz C ci-upstream-gce-leak
2020/10/22 22:09 upstream 96485e446260 4e740c00 .config console log report syz C ci-upstream-gce-leak
2020/10/22 03:44 upstream f804b3159482 be6b1582 .config console log report syz C ci-upstream-gce-leak
2020/10/22 02:04 upstream f804b3159482 be6b1582 .config console log report syz C ci-upstream-gce-leak
2020/10/21 17:16 upstream c4d6fe731176 99c64d5c .config console log report syz C ci-upstream-gce-leak
2020/10/21 13:33 upstream c4d6fe731176 99c64d5c .config console log report syz C ci-upstream-gce-leak
2020/10/21 19:34 upstream c4d6fe731176 99c64d5c .config console log report syz ci-upstream-gce-leak
* Struck through repros no longer work on HEAD.