OSDN Git Service

net: fix indirect calls helpers for ptype list hooks.
authorPaolo Abeni <pabeni@redhat.com>
Tue, 4 Jun 2019 09:44:06 +0000 (11:44 +0200)
committerDavid S. Miller <davem@davemloft.net>
Wed, 5 Jun 2019 03:16:22 +0000 (20:16 -0700)
As Eric noted, the current wrapper for ptype func hook inside
__netif_receive_skb_list_ptype() has no chance of avoiding the indirect
call: we enter such code path only for protocols other than ipv4 and
ipv6.

Instead we can wrap the list_func invocation.

v1 -> v2:
 - use the correct fix tag

Fixes: f5737cbadb7d ("net: use indirect calls helpers for ptype hook")
Suggested-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Acked-by: Edward Cree <ecree@solarflare.com>
Reviewed-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/core/dev.c

index 66f7508..1c4593e 100644 (file)
@@ -5025,12 +5025,12 @@ static inline void __netif_receive_skb_list_ptype(struct list_head *head,
        if (list_empty(head))
                return;
        if (pt_prev->list_func != NULL)
-               pt_prev->list_func(head, pt_prev, orig_dev);
+               INDIRECT_CALL_INET(pt_prev->list_func, ipv6_list_rcv,
+                                  ip_list_rcv, head, pt_prev, orig_dev);
        else
                list_for_each_entry_safe(skb, next, head, list) {
                        skb_list_del_init(skb);
-                       INDIRECT_CALL_INET(pt_prev->func, ipv6_rcv, ip_rcv, skb,
-                                          skb->dev, pt_prev, orig_dev);
+                       pt_prev->func(skb, skb->dev, pt_prev, orig_dev);
                }
 }