Skip to content

Commit

Permalink
IB/cm: Correctly free cm_device structure
Browse files Browse the repository at this point in the history
commit 110cf37 ("infiniband: make cm_device use a struct device and
not a kobject.") introduced a memory leak, since it deleted
cm_release_dev_obj(), which was where cm_dev was freed.  Fix this by
freeing the leaked structure after calling device_unregister().

Signed-off-by: Sean Hefty <sean.hefty@intel.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
  • Loading branch information
Hefty, Sean authored and Roland Dreier committed Sep 30, 2008
1 parent 9824b8f commit a7e80ce
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions drivers/infiniband/core/cm.c
Original file line number Diff line number Diff line change
Expand Up @@ -3748,6 +3748,7 @@ static void cm_add_one(struct ib_device *ib_device)
cm_remove_port_fs(port);
}
device_unregister(cm_dev->device);
kfree(cm_dev);
}

static void cm_remove_one(struct ib_device *ib_device)
Expand Down Expand Up @@ -3776,6 +3777,7 @@ static void cm_remove_one(struct ib_device *ib_device)
cm_remove_port_fs(port);
}
device_unregister(cm_dev->device);
kfree(cm_dev);
}

static int __init ib_cm_init(void)
Expand Down

0 comments on commit a7e80ce

Please sign in to comment.