aboutsummaryrefslogtreecommitdiff
path: root/net/ipv4/netfilter/nf_nat_masquerade_ipv4.c
diff options
context:
space:
mode:
authorAlex Shi <alex.shi@linaro.org>2016-07-20 16:08:14 +0800
committerAlex Shi <alex.shi@linaro.org>2016-07-20 16:08:14 +0800
commit1d508e233d21a7848cf54d7d03b40dac2d9ea873 (patch)
treeeec5222580c4bca752ae35d5cef3842166e6f8c8 /net/ipv4/netfilter/nf_nat_masquerade_ipv4.c
parent439863d92fda525a8f3b326a24490e91c70f0496 (diff)
parent5880876e94699ce010554f483ccf0009997955ca (diff)
Merge remote-tracking branch 'lts/linux-4.1.y' into linux-linaro-lsk-v4.1lsk-v4.1-16.07
Conflicts: pick up 45d1abd9de arm64: Use PoU cache instr for I/D coherency in arch/arm64/mm/flush.c
Diffstat (limited to 'net/ipv4/netfilter/nf_nat_masquerade_ipv4.c')
-rw-r--r--net/ipv4/netfilter/nf_nat_masquerade_ipv4.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/net/ipv4/netfilter/nf_nat_masquerade_ipv4.c b/net/ipv4/netfilter/nf_nat_masquerade_ipv4.c
index c6eb42100e9a..ea91058b5f6f 100644
--- a/net/ipv4/netfilter/nf_nat_masquerade_ipv4.c
+++ b/net/ipv4/netfilter/nf_nat_masquerade_ipv4.c
@@ -108,10 +108,18 @@ static int masq_inet_event(struct notifier_block *this,
unsigned long event,
void *ptr)
{
- struct net_device *dev = ((struct in_ifaddr *)ptr)->ifa_dev->dev;
+ struct in_device *idev = ((struct in_ifaddr *)ptr)->ifa_dev;
struct netdev_notifier_info info;
- netdev_notifier_info_init(&info, dev);
+ /* The masq_dev_notifier will catch the case of the device going
+ * down. So if the inetdev is dead and being destroyed we have
+ * no work to do. Otherwise this is an individual address removal
+ * and we have to perform the flush.
+ */
+ if (idev->dead)
+ return NOTIFY_DONE;
+
+ netdev_notifier_info_init(&info, idev->dev);
return masq_device_event(this, event, &info);
}