netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Paul Bolle <pebolle@tiscali.nl>
To: Dmitry Vyukov <dvyukov@google.com>
Cc: Karsten Keil <isdn@linux-pingi.de>,
	"David S. Miller" <davem@davemloft.net>,
	gigaset307x-common@lists.sourceforge.net, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	syzkaller <syzkaller@googlegroups.com>,
	Kostya Serebryany <kcc@google.com>,
	Alexander Potapenko <glider@google.com>,
	Sasha Levin <sasha.levin@oracle.com>
Subject: Re: gigaset: memory leak in gigaset_initcshw
Date: Wed, 03 Feb 2016 20:11:05 +0100	[thread overview]
Message-ID: <1454526665.14366.22.camel@tiscali.nl> (raw)
In-Reply-To: <1454516189.14366.8.camel@tiscali.nl>

Hi Dmitry,

On wo, 2016-02-03 at 17:16 +0100, Paul Bolle wrote:
> The above should provide me with enough information to figure out
> what's going on here.

I've instrumented ser_gigaset with some printk's. Basically I added the
stuff pasted at the end of this message. In 10.000 runs of the program
syzkaller generated the added printk's suggest that struct ser_cardstate
is freed every time.

(Note that this was done on a machine that, probably like the VM
syzkaller was running in, doesn't have the clunky hardware that this
driver manages attached.)

Before I dive deeper into this: can you reproduce this leak? Is it
perhaps a one in gazillion runs thing? Do you have the logs of a run
that warned about this leak at hand?

Thanks,


Paul Bolle

@@ -375,9 +377,12 @@ static void gigaset_device_release(struct device *dev)
 {
        struct cardstate *cs = dev_get_drvdata(dev);
 
-       if (!cs)
+       if (!cs) {
+               pr_info("%s: no cardstate", __func__);
                return;
+       }
        dev_set_drvdata(dev, NULL);
+       pr_info("%s: kfree(%p)", __func__, cs->hw.ser);
        kfree(cs->hw.ser);
        cs->hw.ser = NULL;
 }
@@ -392,6 +397,7 @@ static int gigaset_initcshw(struct cardstate *cs)
        struct ser_cardstate *scs;
 
        scs = kzalloc(sizeof(struct ser_cardstate), GFP_KERNEL);
+       pr_info("%s: scs = %p", __func__, scs);
        if (!scs) {
                pr_err("out of memory\n");
                return -ENOMEM;

  reply	other threads:[~2016-02-03 19:11 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-03 15:31 gigaset: memory leak in gigaset_initcshw Dmitry Vyukov
2016-02-03 16:16 ` Paul Bolle
2016-02-03 19:11   ` Paul Bolle [this message]
2016-02-04 10:40     ` Dmitry Vyukov
2016-02-04 13:09       ` Paul Bolle
2016-02-04 13:15         ` Dmitry Vyukov
2016-02-04 13:46           ` Paul Bolle
2016-02-04 14:54             ` Dmitry Vyukov
2016-02-04 15:06               ` Paul Bolle
2016-02-05 13:28                 ` Dmitry Vyukov
2016-02-05 16:06                   ` Paul Bolle
2016-02-05 18:36                     ` Paul Bolle
2016-02-05 21:25                       ` Dmitry Vyukov
2016-02-11 22:34                         ` Paul Bolle
2016-02-11 22:54                     ` Paul Bolle

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=1454526665.14366.22.camel@tiscali.nl \
    --to=pebolle@tiscali.nl \
    --cc=davem@davemloft.net \
    --cc=dvyukov@google.com \
    --cc=gigaset307x-common@lists.sourceforge.net \
    --cc=glider@google.com \
    --cc=isdn@linux-pingi.de \
    --cc=kcc@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --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 NNTP newsgroup(s).