[Bugme-new] [Bug 10591] New: [drivers/net/fs_enet/mii-fec.c]: Memory leaks for new_bus and fec

bugme-daemon at bugzilla.kernel.org bugme-daemon at bugzilla.kernel.org
Fri May 2 09:30:17 PDT 2008


http://bugzilla.kernel.org/show_bug.cgi?id=10591

           Summary: [drivers/net/fs_enet/mii-fec.c]: Memory leaks for
                    new_bus and fec
           Product: Drivers
           Version: 2.5
     KernelVersion: 2.6.25.1
          Platform: All
        OS/Version: Linux
              Tree: Mainline
            Status: NEW
          Severity: normal
          Priority: P1
         Component: Network
        AssignedTo: jgarzik at pobox.com
        ReportedBy: danielm77 at spray.se


I think there are some possible memory leaks.

[drivers/net/fs_enet/mii-fec.c:197]: new_bus and fec
[drivers/net/fs_enet/mii-fec.c:306]: new_bus
[drivers/net/fs_enet/mii-fec.c:318]: new_bus and fec


This is the code on lines 181-197 where both new_bus and fec are leaked:

        new_bus = kzalloc(sizeof(struct mii_bus), GFP_KERNEL);
        if (!new_bus)
                goto out;

        fec = kzalloc(sizeof(struct fec_info), GFP_KERNEL);
        if (!fec)
                goto out_mii;

        new_bus->priv = fec;
        new_bus->name = "FEC MII Bus";
        new_bus->read = &fs_enet_fec_mii_read;
        new_bus->write = &fs_enet_fec_mii_write;
        new_bus->reset = &fs_enet_fec_mii_reset;

        ret = of_address_to_resource(ofdev->node, 0, &res);
        if (ret)
                return ret;



This is the code on lines 298-319 where both new_bus and fec are leaked:

        new_bus = kzalloc(sizeof(struct mii_bus), GFP_KERNEL);

        if (NULL == new_bus)
                return -ENOMEM;

        fec = kzalloc(sizeof(struct fec_info), GFP_KERNEL);

        if (NULL == fec)
                return -ENOMEM;

        new_bus->name = "FEC MII Bus",
        new_bus->read = &fs_enet_fec_mii_read,
        new_bus->write = &fs_enet_fec_mii_write,
        new_bus->reset = &fs_enet_fec_mii_reset,
        new_bus->id = pdev->id;

        pdata = (struct fs_mii_fec_platform_info *)pdev->dev.platform_data;

        if (NULL == pdata) {
                printk(KERN_ERR "fs_enet FEC mdio %d: Missing platform
data!\n", pdev->id);
                return -ENODEV;
        }


-- 
Configure bugmail: http://bugzilla.kernel.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


More information about the Bugme-new mailing list