[ofa-general] CM: possible memory leak introduced by commit 110cf374a809817d5c080c0ac82d65d029820a66 (Roland's tree)

Jack Morgenstein jackm at dev.mellanox.co.il
Sun Aug 10 06:12:21 PDT 2008


I think the following patch introduced a memory leak into the cm.
(commit 110cf374a809817d5c080c0ac82d65d029820a66, committed on July 27):

http://git.kernel.org/?p=linux/kernel/git/roland/infiniband.git;a=commitdiff;h=110cf374a809817d5c080c0ac82d65d029820a66;hp=d4c4196f24ade5f336882587480652efde2c739c

Now, no one seems responsible for freeing the memory allocated by
kzalloc in procedure cm_add_one (file drivers/infiniband/core/cm.c):

   /**** jpm: Who deallocates this kzalloc when the cm device is removed??? */
        cm_dev = kzalloc(sizeof(*cm_dev) + sizeof(*port) *
                         ib_device->phys_port_cnt, GFP_KERNEL);
        if (!cm_dev)
               return;

        cm_dev->ib_device = ib_device;
        cm_get_ack_delay(cm_dev);

        cm_dev->device = device_create_drvdata(&cm_class, &ib_device->dev,
                                               MKDEV(0, 0), NULL,
                                               "%s", ib_device->name);

Am I correct?

- Jack



More information about the general mailing list