Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1325885

Re: gigaset: memory leak in gigaset_initcshw

From Paul Bolle <pebolle@tiscali.nl>
Newsgroups linux.kernel
Subject Re: gigaset: memory leak in gigaset_initcshw
Date 2016-02-03 20:20 +0100
Message-ID <qYb86-63C-25@gated-at.bofh.it> (permalink)
References <qY7Hc-3L6-15@gated-at.bofh.it> <qY8jU-4ft-23@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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;

Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

gigaset: memory leak in gigaset_initcshw Dmitry Vyukov <dvyukov@google.com> - 2016-02-03 16:40 +0100
  Re: gigaset: memory leak in gigaset_initcshw Paul Bolle <pebolle@tiscali.nl> - 2016-02-03 17:20 +0100
    Re: gigaset: memory leak in gigaset_initcshw Paul Bolle <pebolle@tiscali.nl> - 2016-02-03 20:20 +0100
      Re: gigaset: memory leak in gigaset_initcshw Dmitry Vyukov <dvyukov@google.com> - 2016-02-04 11:50 +0100
        Re: gigaset: memory leak in gigaset_initcshw Paul Bolle <pebolle@tiscali.nl> - 2016-02-04 14:20 +0100
          Re: gigaset: memory leak in gigaset_initcshw Paul Bolle <pebolle@tiscali.nl> - 2016-02-04 15:00 +0100
            Re: gigaset: memory leak in gigaset_initcshw Dmitry Vyukov <dvyukov@google.com> - 2016-02-04 16:00 +0100
              Re: gigaset: memory leak in gigaset_initcshw Paul Bolle <pebolle@tiscali.nl> - 2016-02-04 16:10 +0100
                Re: gigaset: memory leak in gigaset_initcshw Dmitry Vyukov <dvyukov@google.com> - 2016-02-05 14:40 +0100
                Re: gigaset: memory leak in gigaset_initcshw Paul Bolle <pebolle@tiscali.nl> - 2016-02-05 17:10 +0100
                Re: gigaset: memory leak in gigaset_initcshw Paul Bolle <pebolle@tiscali.nl> - 2016-02-05 19:40 +0100
                Re: gigaset: memory leak in gigaset_initcshw Dmitry Vyukov <dvyukov@google.com> - 2016-02-05 22:30 +0100

csiph-web