<div>Hi~ @list</div><div> </div><div>I'm on my way to jump into the kernel network stack;)</div><div> </div><div>And I find the usage of neigh_tbl_lock might not make sense in following functions</div><div><br clear="all">
static int neigh_delete(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg)</div><div>static int neigh_add(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg)</div><div> </div><div>They both have the following code snippets</div>
<div> </div><div>read_lock(&neigh_tbl_lock); --L1<br> for (tbl = neigh_tables; tbl; tbl = tbl->next) { --L2<br> struct neighbour *neigh; --L3</div>
<div> if (tbl->family != ndm->ndm_family) --L4<br> continue; --L5<br> read_unlock(&neigh_tbl_lock); --L6</div>
<div> if (nla_len(dst_attr) < tbl->key_len) --L7<br> goto out_dev_put;</div><div> </div><div> </div><div>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?</div>
<div>Am I wrong?</div><div> </div><div><br>-- <br>Yours sincerely<br>Jammy<br>
</div>