neigh_tbl_lock usage in net/core/neighbour.c

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

Hi~ @list
I'm on my way to jump into the kernel network stack;)
And I find the usage of neigh_tbl_lock might not make sense in following functions

static int neigh_delete(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg)
static int neigh_add(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg)
They both have the following code snippets
read_lock(&neigh_tbl_lock);                                       --L1
 for (tbl = neigh_tables; tbl; tbl = tbl->next) {               --L2
  struct neighbour *neigh;                                           --L3
  if (tbl->family != ndm->ndm_family)                          --L4
   continue;                                                                  --L5
  read_unlock(&neigh_tbl_lock);                                 --L6
  if (nla_len(dst_attr) < tbl->key_len)                           --L7
   goto out_dev_put;
IMHO, there might be some race condition after L6. I mean when the L7 use the tbl, is it possible other processor releasing the table entry?
Am I wrong?

Yours sincerely
Kernelnewbies mailing list

[Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Photo]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Networking]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]

Add to Google Powered by Linux