I would really appreciate if someone can explain why I see the title issue occasionally. Here are the rel info.

Linux ver: 2.6.32.25(i686 GNU/Linux)

Problem description:
I have modified kernel space IP stack code to install a route in the IP routing table under certain condtions. For example, when a telnet packet is received I install a route. I done this in kernel IP input processing code by calling API, inet_ioctl to install the route.

Most of the time the (above changed) code works fine and installs route in the routing table successfully. Occasionally, I see the kernel BUG message with following trace. Usually when I telnet continuously I see this more often.

BUG: scheduling while atomic: swapper/0/0x10000100
Call Trace:
[ 476.455950] [<c0101ca7>] cpu_idle+0x49/0x6a
[ 476.456403] [<c053de5f>] rest_init+0x53/0x55
[ 476.456403] [<c07e77e1>] start_kernel+0x2ac/0x2b1
[ 476.457418] [<c07e7091>] i386_start_kernel+0x91/0x96

Any help would be much appreciated.
Thanks.