[openib-general] Re: slab error in kmem_cache_destroy(): cache `ib_mad': Can't free all objects

Michael S. Tsirkin mst at mellanox.co.il
Tue May 3 00:27:27 PDT 2005


Quoting r. Roland Dreier <roland at topspin.com>:
> Subject: Re: slab error in kmem_cache_destroy(): cache `ib_mad': Can't free all objects
> 
>     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?
> 
>  - 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;
> 

Right, but this wont be related to the kmem_cache leak I see, will it?


-- 
MST - Michael S. Tsirkin



More information about the general mailing list