mirror of https://lore.kernel.org/lkml/
 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@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: Fri, 05 Feb 2016 19:36:01 +0100	[thread overview]
Message-ID: <1454697361.28847.39.camel@tiscali.nl> (raw)
In-Reply-To: <1454688387.28847.34.camel@tiscali.nl>

On vr, 2016-02-05 at 17:06 +0100, Paul Bolle wrote:
> If that would happen, then cs can be reused while the previous
> > cs->hw.ser is not freed yet. Just a guess.
> 
> I'll have to ponder on that a bit, sorry.

This is from the hit-the-code-until-it-confesses department:
--- a/drivers/isdn/gigaset/ser-gigaset.c
+++ b/drivers/isdn/gigaset/ser-gigaset.c
@@ -373,13 +373,9 @@ static void gigaset_freecshw(struct cardstate *cs)
 
 static void gigaset_device_release(struct device *dev)
 {
-       struct cardstate *cs = dev_get_drvdata(dev);
-
-       if (!cs)
-               return;
+       struct ser_cardstate *scs = dev_get_drvdata(dev);
        dev_set_drvdata(dev, NULL);
-       kfree(cs->hw.ser);
-       cs->hw.ser = NULL;
+       kfree(scs);
 }
 
 /*
@@ -408,7 +404,7 @@ static int gigaset_initcshw(struct cardstate *cs)
                cs->hw.ser = NULL;
                return rc;
        }
-       dev_set_drvdata(&cs->hw.ser->dev.dev, cs);
+       dev_set_drvdata(&cs->hw.ser->dev.dev, scs);
 
        tasklet_init(&cs->write_tasklet,
                     gigaset_modem_fill, (unsigned long) cs);

Does that make any difference?


Paul Bolle

  reply	other threads:[~2016-02-05 18:36 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-03 15:31 Dmitry Vyukov
2016-02-03 16:16 ` Paul Bolle
2016-02-03 19:11   ` Paul Bolle
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 [this message]
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=1454697361.28847.39.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

all inboxes | Powered by JetHome®