Commit ef47c6a7b8e36e3b160433673b1b68db799aabcd

Authored by Patrick McHardy
Committed by David S. Miller
1 parent 1c7e47726a

[NETFILTER]: ip_queue/nfnetlink_queue: drop bridge port references when dev disappears

When a device that is acting as a bridge port is unregistered, the
ip_queue/nfnetlink_queue notifier doesn't check if its one of
physindev/physoutdev and doesn't release the references if it is.

Signed-off-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: David S. Miller <davem@davemloft.net>

Showing 2 changed files with 20 additions and 4 deletions Side-by-side Diff

net/ipv4/netfilter/ip_queue.c
... ... @@ -457,11 +457,19 @@
457 457 if (entry->info->indev)
458 458 if (entry->info->indev->ifindex == ifindex)
459 459 return 1;
460   -
461 460 if (entry->info->outdev)
462 461 if (entry->info->outdev->ifindex == ifindex)
463 462 return 1;
464   -
  463 +#ifdef CONFIG_BRIDGE_NETFILTER
  464 + if (entry->skb->nf_bridge) {
  465 + if (entry->skb->nf_bridge->physindev &&
  466 + entry->skb->nf_bridge->physindev->ifindex == ifindex)
  467 + return 1;
  468 + if (entry->skb->nf_bridge->physoutdev &&
  469 + entry->skb->nf_bridge->physoutdev->ifindex == ifindex)
  470 + return 1;
  471 + }
  472 +#endif
465 473 return 0;
466 474 }
467 475  
net/netfilter/nfnetlink_queue.c
... ... @@ -680,11 +680,19 @@
680 680 if (entinf->indev)
681 681 if (entinf->indev->ifindex == ifindex)
682 682 return 1;
683   -
684 683 if (entinf->outdev)
685 684 if (entinf->outdev->ifindex == ifindex)
686 685 return 1;
687   -
  686 +#ifdef CONFIG_BRIDGE_NETFILTER
  687 + if (entry->skb->nf_bridge) {
  688 + if (entry->skb->nf_bridge->physindev &&
  689 + entry->skb->nf_bridge->physindev->ifindex == ifindex)
  690 + return 1;
  691 + if (entry->skb->nf_bridge->physoutdev &&
  692 + entry->skb->nf_bridge->physoutdev->ifindex == ifindex)
  693 + return 1;
  694 + }
  695 +#endif
688 696 return 0;
689 697 }
690 698