Skip to contentSkip to conversation

kfree error oops

DISCUSSION selvakumar nagendran 2 participants 2 messages Jan 11, 2005

lore
Share & tools
lore
#0 lore raw

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);
}
--------------
<1>Unable to handle kernel paging request at virtual
address 170fc2ad
Jan 10 14:57:17 cbl032 kernel:  printing eip:
d076b210
*pde = 00000000
Oops: 0000
CPU:    0
EIP:    0010:[<d076b210>]    Not tainted
EFLAGS: 00010206
eax: 170fc2a5   ebx: ca502000   ecx: 00000020   edx:
ffffffff
esi: 00000400   edi: 00000000   ebp: bffffb98   esp:
ca503fa4
Jan 10 14:57:17 cbl032 random: Saving random seed: 
failed
ds: 0018   es: 0018   ss: 0018
Process initlog (pid: 6677, stackpage=ca503000)
Stack: 00000020 ffffffff 00000001 c01166c0 bffffb98
c0108ccc ca502000 c0108bdb 
       00000020 4b26f940 00000020 00000400 00000000
bffffb98 00000006 0000002b 
       0000002b 00000006 4b208ba1 00000023 00000246
bffffb4c 0000002b 
Call Trace:    [<c01166c0>] [<c0108ccc>] [<c0108bdb>]

Code: 8b 40 08 8b 40 08 8b 50 28 89 54 24 04 c7 44 24

08 01 00 00

__________________________________
Do you Yahoo!?
Yahoo! Mail - 250MB free storage. Do more. Manage less.
http://info.mail.yahoo.com/mail_250

#1 lore raw
Quoted 12 lines · selvakumar nagendran

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])

Quoted 12 lines
{
	//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.