net: memory leak in lapb_register

33 views
Skip to first unread message

Dmitry Vyukov

unread,
Feb 22, 2016, 5:09:49 AM2/22/16
to David S. Miller, linu...@vger.kernel.org, netdev, LKML, Greg Kroah-Hartman, Jiri Slaby, Peter Hurley, syzkaller, Kostya Serebryany, Alexander Potapenko, Sasha Levin
Hello,

The following program causes a memory leak of an object allocated in
lapb_register:

// autogenerated by syzkaller (http://github.com/google/syzkaller)
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#include <stdlib.h>
#include <linux/tty.h>

int main(int argc, char **argv)
{
int fd, val;

fd = open("/dev/ptmx", O_RDWR);
val = N_X25;
ioctl(fd, TIOCSETD, &val);
return 0;
}



unreferenced object 0xffff880034b943d8 (size 512):
comm "softirq", pid 0, jiffies 4294896736 (age 10.460s)
hex dump (first 32 bytes):
00 01 00 00 00 00 ad de 00 02 00 00 00 00 ad de ................
c0 a3 d3 35 00 88 ff ff 00 00 00 00 00 00 00 00 ...5............
backtrace:
[<ffffffff86680923>] kmemleak_alloc+0x63/0xa0 mm/kmemleak.c:916
[< inline >] kmemleak_alloc_recursive include/linux/kmemleak.h:47
[< inline >] slab_post_alloc_hook mm/slub.c:1337
[< inline >] slab_alloc_node mm/slub.c:2596
[< inline >] slab_alloc mm/slub.c:2604
[<ffffffff8176ae6e>] kmem_cache_alloc_trace+0x1ee/0x350 mm/slub.c:2621
[< inline >] kzalloc include/linux/slab.h:463
[< inline >] lapb_create_cb net/lapb/lapb_iface.c:121
[<ffffffff85ca303a>] lapb_register+0xfa/0x590 net/lapb/lapb_iface.c:158
[< inline >] x25_asy_open drivers/net/wan/x25_asy.c:485
[<ffffffff83fa82d8>] x25_asy_open_tty+0x438/0x760
drivers/net/wan/x25_asy.c:573
[<ffffffff82fbd258>] tty_ldisc_open.isra.2+0x78/0xd0
drivers/tty/tty_ldisc.c:454
[<ffffffff82fbd842>] tty_set_ldisc+0x292/0x8a0 drivers/tty/tty_ldisc.c:561
[< inline >] tiocsetd drivers/tty/tty_io.c:2655
[<ffffffff82fa651e>] tty_ioctl+0xb2e/0x2160 drivers/tty/tty_io.c:2910
[< inline >] vfs_ioctl fs/ioctl.c:43
[<ffffffff8180597c>] do_vfs_ioctl+0x18c/0xfb0 fs/ioctl.c:674
[< inline >] SYSC_ioctl fs/ioctl.c:689
[<ffffffff8180682f>] SyS_ioctl+0x8f/0xc0 fs/ioctl.c:680
[<ffffffff8669ddb6>] entry_SYSCALL_64_fastpath+0x16/0x7a
arch/x86/entry/entry_64.S:185
[<ffffffffffffffff>] 0xffffffffffffffff


On commit 23300f657594656e7ebac3130b43460ebc4381cc (Feb 19).

Dmitry Vyukov

unread,
Jun 22, 2016, 4:24:49 AM6/22/16
to David S. Miller, linu...@vger.kernel.org, netdev, LKML, Greg Kroah-Hartman, Jiri Slaby, Peter Hurley, syzkaller, Kostya Serebryany, Alexander Potapenko, Sasha Levin
Ping. Just hit it again on 67016f6cdfd079e632bbc49e33178b2d558c120a (Jun 20):


2016/06/22 04:19:27 BUG: memory leak:
eferenced object 0xffff88005b07a420 (size 512):
comm "softirq", pid 0, jiffies 4296660857 (age 7.988s)
hex dump (first 32 bytes):
00 01 00 00 00 00 ad de 00 02 00 00 00 00 ad de ................
40 c5 22 5b 00 88 ff ff 00 00 00 00 00 00 00 00 @."[............
backtrace:
[<ffffffff86a791b3>] kmemleak_alloc+0x63/0xa0 mm/kmemleak.c:915
[< inline >] kmemleak_alloc_recursive include/linux/kmemleak.h:47
[< inline >] slab_post_alloc_hook mm/slab.h:406
[< inline >] slab_alloc_node mm/slub.c:2572
[< inline >] slab_alloc mm/slub.c:2580
[<ffffffff817b8660>] kmem_cache_alloc_trace+0x160/0x3d0 mm/slub.c:2597
[< inline >] kzalloc include/linux/slab.h:478
[< inline >] lapb_create_cb net/lapb/lapb_iface.c:121
[<ffffffff8607a8aa>] lapb_register+0xfa/0x590 net/lapb/lapb_iface.c:158
[< inline >] x25_asy_open drivers/net/wan/x25_asy.c:485
[<ffffffff84176768>] x25_asy_open_tty+0x438/0x760
drivers/net/wan/x25_asy.c:573
[<ffffffff8311da38>] tty_ldisc_open.isra.3+0x78/0xd0
drivers/tty/tty_ldisc.c:463
[<ffffffff8311dd30>] tty_set_ldisc+0x2a0/0x8b0 drivers/tty/tty_ldisc.c:575
[< inline >] tiocsetd drivers/tty/tty_io.c:2667
[<ffffffff83108a95>] tty_ioctl+0xb55/0x21b0 drivers/tty/tty_io.c:2924
[< inline >] vfs_ioctl fs/ioctl.c:43
[<ffffffff818510bc>] do_vfs_ioctl+0x18c/0xff0 fs/ioctl.c:674
[< inline >] SYSC_ioctl fs/ioctl.c:689
[<ffffffff81851faf>] SyS_ioctl+0x8f/0xc0 fs/ioctl.c:680
[<ffffffff86a97000>] entry_SYSCALL_64_fastpa
Reply all
Reply to author
Forward
0 new messages