Re: kfree error oops

From: Arjan van de Ven
Date: Tue Jan 11 2005 - 03:35:19 EST


On Tue, 2005-01-11 at 00:23 -0800, selvakumar nagendran wrote:
> Hello linux-experts,
> While I tried to free the memory I allocated
> using kfree, I received the following error:
> I am working in kernel 2.4.28.
> I have also attached the code. Can anyone help me
> regarding this? I have also checked for NULL pointer
> even though it is not necessary.
>
> Thanks,
> selva
> -----------------------
> list_for_each(p,&rhash_table[i])
> {
> //printk("\n Printing details for my..");
>
> my = list_entry(p, struct resource, res_list);
> if(my)
> {
> printk("\n My is not null..");
> printk("\n%ld,", my -> rid.fd);
> printk("%ld,", my -> rid.inode);
> printk("%d,", my -> rid.ACCESS_TYPE);
> list_del(&my -> res_list);
> kfree(my);

this is not allowed in list_for_each,
you must use list_for_each_safe() instead.


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/