提交 cd0bf2d7 编写于 作者: P Patrick McHardy 提交者: David S. Miller

[NETFILTER]: Fix rcu race in ipt_REDIRECT

Signed-off-by: NPatrick McHardy <kaber@trash.net>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 e7fa1bd9
......@@ -88,14 +88,18 @@ redirect_target(struct sk_buff **pskb,
newdst = htonl(0x7F000001);
else {
struct in_device *indev;
struct in_ifaddr *ifa;
/* Device might not have an associated in_device. */
indev = (struct in_device *)(*pskb)->dev->ip_ptr;
if (indev == NULL || indev->ifa_list == NULL)
return NF_DROP;
newdst = 0;
rcu_read_lock();
indev = __in_dev_get((*pskb)->dev);
if (indev && (ifa = indev->ifa_list))
newdst = ifa->ifa_local;
rcu_read_unlock();
/* Grab first address on interface. */
newdst = indev->ifa_list->ifa_local;
if (!newdst)
return NF_DROP;
}
/* Transfer from original range. */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册