Received a panic while closing the file.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi All,

I am writing a very simple file system for understanding purpose.
After mounting the file system, I am able to create file and read
write to the file. But, as soon as close the file, it is panicking.

I did some analysis and found that

My kernel has CONFIG_EPOLL enabled

struct file
{
      .............
      .............
      #ifdef CONFIG_EPOLL
      /* Used by fs/eventpoll.c to link all the hooks to this file */
      struct list_head    f_ep_links;
       spinlock_t      f_ep_lock;
      #endif /* #ifdef CONFIG_EPOLL */
      .............
      .............
};

This is the stack trace of the oops

[ 4960.322635] EIP: [<c01f3ffe>] list_del+0xa/0x61 SS:ESP 0068:e9464f20
[ 4960.322511]  [<c0179342>] eventpoll_release_file+0x25/0x69
[ 4960.322519]  [<c0155b0a>] __fput+0xa3/0x15a
[ 4960.322526]  [<c0155bd8>] fput+0x17/0x19
[ 4960.322532]  [<c0153610>] filp_close+0x54/0x5c
[ 4960.322539]  [<c015e6e9>] sys_dup2+0xd0/0xfc
[ 4960.322547]  [<c0103854>] sysenter_past_esp+0x5d/0x99

eventpoll_release_file () functions result in the call to list_del()

void list_del(struct list_head *entry)
{
if (unlikely(entry->prev->next != entry)) {  <==== THIS IS THE LINE
WHERE OOPS IN HAPPENING
      printk(KERN_ERR "list_del corruption. prev->next should be %p, "
              "but was %p\n", entry, entry->prev->next);
      BUG();
  }
  if (unlikely(entry->next->prev != entry)) {
      printk(KERN_ERR "list_del corruption. next->prev should be %p, "
              "but was %p\n", entry, entry->next->prev);
      BUG();
  }
  __list_del(entry->prev, entry->next);
  entry->next = LIST_POISON1;
  entry->prev = LIST_POISON2;
}


This is the panic string
BUG: unable to handle kernel NULL pointer dereference at virtual
address 00000000

So, I think file->f_ep_links is not initialized in my code.

Can anyone please let me know the reason
Why event polls are used? and
What function should I call for initializing the file-> f_ep_links list.?

Thanks and Regards,
Prasad.

ADDING OOPS IF REQUIRED FOR THE REFERENCE

Here is the oops msg.

[ 4960.322267] Inode Created : 17190 = test<1>BUG: unable to handle
kernel NULL pointer dereference at virtual address 00000000
[ 4960.322328] printing eip:
[ 4960.322332] c01f3ffe
[ 4960.322335] *pde = 00000000
[ 4960.322341] Oops: 0000 [#2]
[ 4960.322344] SMP
[ 4960.322350] Modules linked in: fs cpufreq_stats
cpufreq_ondemandfreq_table ac evdev thermal processor fan
[ 4960.322370] CPU: 1
[ 4960.322372] EIP: 0060:[<c01f3ffe>] Not tainted VLI
[ 4960.322376] EFLAGS: 00010282 (2.6.20 #8)
[ 4960.322386
] EIP is at list_del+0xa/0x61
[ 4960.322391] eax: f8868080   ebx: f8868044   ecx: 00000000   edx:
e75ef5cc
[ 4960.322398] esi: f8868080   edi: 00000000   ebp: e9464f30   esp:
e9464f20
[ 4960.322403] ds: 007b   es: 007b   ss: 0068
[ 4960.322409] Process bash (pid: 6062, ti=e9464000 task=f751b4f0
task.ti=e9464000)
[ 4960.322415] Stack: e75ef5cc e9464f30 c0344186 f8868044 e9464f48
c0179342 e75ef5cc 00000008
[ 4960.322430]        f599e03c e75ef5cc e9464f70 c0155b0a 00000000
00000000 e826b1cc dfff0988
[ 4960.322445]        f599e03c e75ef5cc f7baaca8 00000000 e9464f78
c0155bd8 e9464f90 c0153610
[ 4960.322459] Call Trace:
[ 4960.322462]  [<c01048a2>] show_trace_log_lvl+0x1a/0x2f
[ 4960.322472]  [<c0104954>] show_stack_log_lvl+0x9d/0xa5
[ 4960.322481]  [<c0104af1>] show_registers+0x195/0x26b
[ 4960.322489]  [<c0104ce0>] die+0x119/0x21a
[ 4960.322496]  [<c034713d>] do_page_fault+0x443/0x514
[ 4960.322504]  [<c034597c>] error_code+0x7c/0x84
[ 4960.322511]  [<c0179342>] eventpoll_release_file+0x25/0x69
[ 4960.322519]  [<c0155b0a>] __fput+0xa3/0x15a
[ 4960.322526]  [<c0155bd8>] fput+0x17/0x19
[ 4960.322532]  [<c0153610>] filp_close+0x54/0x5c
[ 4960.322539]  [<c015e6e9>] sys_dup2+0xd0/0xfc
[ 4960.322547]  [<c0103854>] sysenter_past_esp+0x5d/0x99
[ 4960.322555]  =======================
[ 4960.322558] Code: 00 00 8d 4b 0c 8b 51 04 8d 46 0c e8 72 00 00 00
89 f8 e8 87 fe ff ff 83 c4 10 5b 5e 5f 5d c3 90 90 55 89 e5 53 83 ec
0c 8b 48 04 <8b> 11 39 c2 74 18 89 54 24 08 89 44 24 04 c7 04 24 92 37
3e c0
[ 4960.322635] EIP: [<c01f3ffe>] list_del+0xa/0x61 SS:ESP 0068:e9464f20

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux