On 5/13/19 10:03 AM, mcma...@arista.com wrote:
> diff --git a/net/core/neighbour.c b/net/core/neighbour.c
> index 30f6fd8f68e0..981f1568710b 100644
> --- a/net/core/neighbour.c
> +++ b/net/core/neighbour.c
> +static int neigh_find_fill(struct neigh_table *tbl, const void *pkey,
> +                           struct net_device *dev, struct sk_buff *skb, u32 
> pid,
> +                           u32 seq)
> +{
> +     struct neighbour *neigh;
> +     int key_len = tbl->key_len;
> +     u32 hash_val;
> +     struct neigh_hash_table *nht;
> +     int err;

reverse xmas tree ordering

...

> +static int neigh_get(struct sk_buff *skb, struct nlmsghdr *nlh)
> +{
> +     struct net *net = sock_net(skb->sk);
> +     struct ndmsg *ndm;
> +     struct nlattr *dst_attr;
> +     struct neigh_table *tbl;
> +     struct net_device *dev = NULL;
> +
> +     ASSERT_RTNL();
> +     if (nlmsg_len(nlh) < sizeof(*ndm))
> +             return -EINVAL;
> +
> +     dst_attr = nlmsg_find_attr(nlh, sizeof(*ndm), NDA_DST);
> +     if (dst_attr == NULL)
> +             return -EINVAL;
> +
> +     ndm = nlmsg_data(nlh);
> +     if (ndm->ndm_ifindex) {
> +             dev = __dev_get_by_index(net, ndm->ndm_ifindex);
> +             if (dev == NULL)
> +                     return -ENODEV;
> +     }
> +
> +     read_lock(&neigh_tbl_lock);

this patch is clearly for a MUCH older kernel than 5.2 (like 3.18
maybe?) as that lock no longer exists.

> +     for (tbl = neigh_tables; tbl; tbl = tbl->next) {
> +             struct sk_buff *nskb;
> +             int err;
> +
> +             if (tbl->family != ndm->ndm_family)
> +                     continue;

Use neigh_find_table.

You need to update the patch to top of net-next tree and re-work the
locking. Run tests with RCU and lock debugging enabled to make sure you
have it right.

Reply via email to