linux-x25.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dmitry Vyukov <dvyukov@google.com>
To: "David S. Miller" <davem@davemloft.net>,
	linux-x25@vger.kernel.org, netdev <netdev@vger.kernel.org>,
	LKML <linux-kernel@vger.kernel.org>,
	Peter Hurley <peter@hurleysoftware.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Jiri Slaby <jslaby@suse.com>
Cc: syzkaller <syzkaller@googlegroups.com>,
	Kostya Serebryany <kcc@google.com>,
	Alexander Potapenko <glider@google.com>,
	Sasha Levin <sasha.levin@oracle.com>,
	Eric Dumazet <edumazet@google.com>
Subject: memory leak in lapb_create_cb
Date: Wed, 30 Dec 2015 22:00:44 +0100	[thread overview]
Message-ID: <CACT4Y+b59Ct8YXezM+HKGDfrV9YYLcB=Hi1YNNpe41JMQRAoFw@mail.gmail.com> (raw)

Hello,

The following program leads to a leak of struct lapb_cb:

// autogenerated by syzkaller (http://github.com/google/syzkaller)
#include <unistd.h>
#include <sys/syscall.h>
#include <string.h>
#include <stdint.h>

int main()
{
        syscall(SYS_mmap, 0x20000000ul, 0x10000ul, 0x3ul, 0x32ul,
0xfffffffffffffffful, 0x0ul);
        int fd = syscall(SYS_open, "/dev/ptmx", 0x103002ul, 0x0ul, 0, 0, 0);
        *(uint32_t*)0x20001000 = (uint32_t)0x6;
        syscall(SYS_ioctl, fd, 0x5423ul, 0x20001000ul, 0, 0, 0);
        *(uint32_t*)0x20006ff8 = (uint32_t)0x1;
        *(uint8_t*)0x20006ffc = (uint8_t)0x29c;
        *(uint8_t*)0x20006ffd = (uint8_t)0x3;
        *(uint8_t*)0x20006ffe = (uint8_t)0x4;
        *(uint8_t*)0x20006fff = (uint8_t)0x8;
        *(uint8_t*)0x20007000 = (uint8_t)0x3;
        *(uint8_t*)0x20007001 = (uint8_t)0x1;
        syscall(SYS_ioctl, fd, 0x400442c9ul, 0x20006ff8ul, 0, 0, 0);
        *(uint8_t*)0x20006f64 = (uint8_t)0xe7;
        *(uint8_t*)0x20006f65 = (uint8_t)0xfb49;
        *(uint16_t*)0x20006f66 = (uint16_t)0x3;
        syscall(SYS_ioctl, fd, 0x4b46ul, 0x20006f64ul, 0, 0, 0);
        *(uint16_t*)0x20003000 = (uint16_t)0x8;
        *(uint16_t*)0x20003002 = (uint16_t)0x5;
        *(uint16_t*)0x20003004 = (uint16_t)0x8;
        *(uint16_t*)0x20003006 = (uint16_t)0x3;
        *(uint8_t*)0x20003008 = (uint8_t)0x6;
        *(uint8_t*)0x20003009 = (uint8_t)0x4b8;
        *(uint8_t*)0x2000300a = (uint8_t)0x2;
        *(uint8_t*)0x2000300b = (uint8_t)0x1;
        *(uint32_t*)0x2000300c = (uint32_t)0x5;
        *(uint8_t*)0x20003010 = (uint8_t)0x802;
        syscall(SYS_ioctl, fd, 0x5404ul, 0x20003000ul, 0, 0, 0);
        return 0;
}


unreferenced object 0xffff8800633575d0 (size 512):
  comm "softirq", pid 0, jiffies 4299764624 (age 16.395s)
  hex dump (first 32 bytes):
    00 01 00 00 00 00 ad de 00 02 00 00 00 00 ad de  ................
    c0 a3 d4 34 00 88 ff ff 00 00 00 00 00 00 00 00  ...4............
  backtrace:
    [<ffffffff85c73a22>] kmemleak_alloc+0x72/0xc0 mm/kmemleak.c:915
    [<     inline     >] kmemleak_alloc_recursive include/linux/kmemleak.h:47
    [<     inline     >] slab_post_alloc_hook mm/slub.c:1335
    [<     inline     >] slab_alloc_node mm/slub.c:2594
    [<     inline     >] slab_alloc mm/slub.c:2602
    [<ffffffff816cc6f8>] kmem_cache_alloc_trace+0x138/0x2f0 mm/slub.c:2619
    [<     inline     >] kzalloc include/linux/slab.h:458
    [<     inline     >] lapb_create_cb net/lapb/lapb_iface.c:121
    [<ffffffff852ec5ea>] lapb_register+0xfa/0x590 net/lapb/lapb_iface.c:158
    [<     inline     >] x25_asy_open drivers/net/wan/x25_asy.c:485
    [<ffffffff83a69351>] x25_asy_open_tty+0x431/0x740
drivers/net/wan/x25_asy.c:573
    [<ffffffff82bacd58>] tty_ldisc_open.isra.2+0x78/0xd0
drivers/tty/tty_ldisc.c:447
    [<ffffffff82bad41a>] tty_set_ldisc+0x1ca/0xa30 drivers/tty/tty_ldisc.c:567
    [<     inline     >] tiocsetd drivers/tty/tty_io.c:2650
    [<ffffffff82b9481a>] tty_ioctl+0xb2a/0x2160 drivers/tty/tty_io.c:2883
    [<     inline     >] vfs_ioctl fs/ioctl.c:43
    [<ffffffff81750d41>] do_vfs_ioctl+0x681/0xe40 fs/ioctl.c:607
    [<     inline     >] SYSC_ioctl fs/ioctl.c:622
    [<ffffffff8175158f>] SyS_ioctl+0x8f/0xc0 fs/ioctl.c:613
    [<ffffffff85c8eaf6>] entry_SYSCALL_64_fastpath+0x16/0x7a
arch/x86/entry/entry_64.S:185
    [<ffffffffffffffff>] 0xffffffffffffffff


On commit 8513342170278468bac126640a5d2d12ffbff106 (Dec 28).

             reply	other threads:[~2015-12-30 21:00 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-30 21:00 Dmitry Vyukov [this message]
2016-01-13 16:46 ` memory leak in lapb_create_cb David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CACT4Y+b59Ct8YXezM+HKGDfrV9YYLcB=Hi1YNNpe41JMQRAoFw@mail.gmail.com' \
    --to=dvyukov@google.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=glider@google.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jslaby@suse.com \
    --cc=kcc@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-x25@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=peter@hurleysoftware.com \
    --cc=sasha.levin@oracle.com \
    --cc=syzkaller@googlegroups.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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 read-only IMAP folder(s) and NNTP newsgroup(s).