netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* net: memory leak in lapb_register
@ 2016-02-22 10:09 Dmitry Vyukov
  2016-06-22  8:24 ` Dmitry Vyukov
  0 siblings, 1 reply; 2+ messages in thread
From: Dmitry Vyukov @ 2016-02-22 10:09 UTC (permalink / raw)
  To: David S. Miller, linux-x25, netdev, LKML, Greg Kroah-Hartman,
	Jiri Slaby, Peter Hurley
  Cc: 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).

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: net: memory leak in lapb_register
  2016-02-22 10:09 net: memory leak in lapb_register Dmitry Vyukov
@ 2016-06-22  8:24 ` Dmitry Vyukov
  0 siblings, 0 replies; 2+ messages in thread
From: Dmitry Vyukov @ 2016-06-22  8:24 UTC (permalink / raw)
  To: David S. Miller, linux-x25, netdev, LKML, Greg Kroah-Hartman,
	Jiri Slaby, Peter Hurley
  Cc: syzkaller, Kostya Serebryany, Alexander Potapenko, Sasha Levin

On Mon, Feb 22, 2016 at 11:09 AM, Dmitry Vyukov <dvyukov@google.com> wrote:
> 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).


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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-06-22  8:30 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-02-22 10:09 net: memory leak in lapb_register Dmitry Vyukov
2016-06-22  8:24 ` Dmitry Vyukov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).