[openib-general] slab error in kmem_cache_destroy(): cache `ib_mad': Can't free all objects
Hal Rosenstock
halr at voltaire.com
Mon May 2 14:00:58 PDT 2005
On Mon, 2005-05-02 at 16:59, Roland Dreier wrote:
> Hal> Also, does user_mad.c leak memory on the receive side if it
> Hal> is shutdown and the application has not drained the receive
> Hal> queue ?
>
> Yes, looks like it. Something like this (completely untested) should
> fix it, right?
Yes, this looks right. Wish I had a test case for this to prove it :-)
-- Hal
> - R.
>
> -- infiniband/core/user_mad.c (revision 2211)
> +++ infiniband/core/user_mad.c (working copy)
> @@ -499,6 +499,7 @@ static int ib_umad_open(struct inode *in
> static int ib_umad_close(struct inode *inode, struct file *filp)
> {
> struct ib_umad_file *file = filp->private_data;
> + struct ib_umad_packet *packet, *tmp;
> int i;
>
> for (i = 0; i < IB_UMAD_MAX_AGENTS; ++i)
> @@ -507,6 +508,9 @@ static int ib_umad_close(struct inode *i
> ib_unregister_mad_agent(file->agent[i]);
> }
>
> + list_for_each_entry_safe(packet, tmp, &file->recv_list, list)
> + kfree(packet);
> +
> kfree(file);
>
> return 0;
More information about the general
mailing list