Hello Pradeep and all, I use list_for_each_safe and it works like a charm! Thanks a lot! Ron On 9/26/07, pradeep singh <2500.pradeep@xxxxxxxxx> wrote: > On 9/26/07, Ron Lee <ronberlin@xxxxxxxxxxxxxx> wrote: > > Hello all, > > > > I am trying to use the standard structure list_head for linked lists > > in the kernel. So far, I can search and add items to my linked list. > > I can remove items from my linked list. > > > > But when I want to purge the entire linked list. I get a kernel oops. > > Does anyone have any suggestions? Any help is highly appreciated! > I hope you are initialising your list properly? > Assuming you are, i would like to suggest protecting your list using a > lock, because lists themselves do not provide any locking protection. > Maybe some element gets deleted before you can do anything with it in > your free routine? > BTW try list_for_each_safe to avoid any unnecessary surprises while deletion. > > Its a guess, after looking at the provided snippet. > HTH > > Thanks > --pradeep > > > > Thanks, > > Ron > > > > struct frule { > > int data; > > struct list_head list; > > }; > > > > static void release_frules(struct frule *frs) > > { > > struct frule *fr; > > struct list_head *p; > > > > list_for_each(p, frs) { > > fr = list_entry(p, struct frule, list); > > list_del(p); > > kfree(fr); > > } > > > > return; > > } > > > > -- > > To unsubscribe from this list: send an email with > > "unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx > > Please read the FAQ at http://kernelnewbies.org/FAQ > > > > > > > -- > play the game > -- To unsubscribe from this list: send an email with "unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx Please read the FAQ at http://kernelnewbies.org/FAQ