Commit cd0bf2d7 authored by Patrick McHardy's avatar Patrick McHardy Committed by David S. Miller

[NETFILTER]: Fix rcu race in ipt_REDIRECT

Signed-off-by: default avatarPatrick McHardy <kaber@trash.net>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent e7fa1bd9
...@@ -88,14 +88,18 @@ redirect_target(struct sk_buff **pskb, ...@@ -88,14 +88,18 @@ redirect_target(struct sk_buff **pskb,
newdst = htonl(0x7F000001); newdst = htonl(0x7F000001);
else { else {
struct in_device *indev; struct in_device *indev;
struct in_ifaddr *ifa;
/* Device might not have an associated in_device. */ newdst = 0;
indev = (struct in_device *)(*pskb)->dev->ip_ptr;
if (indev == NULL || indev->ifa_list == NULL) rcu_read_lock();
return NF_DROP; indev = __in_dev_get((*pskb)->dev);
if (indev && (ifa = indev->ifa_list))
newdst = ifa->ifa_local;
rcu_read_unlock();
/* Grab first address on interface. */ if (!newdst)
newdst = indev->ifa_list->ifa_local; return NF_DROP;
} }
/* Transfer from original range. */ /* Transfer from original range. */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment