diff mbox series

net: ipv4: Fix wrong type conversion from hint to rt in ip_route_use_hint()

Message ID 1593244071-28291-1-git-send-email-linmiaohe@huawei.com
State Accepted
Delegated to: David Miller
Headers show
Series net: ipv4: Fix wrong type conversion from hint to rt in ip_route_use_hint() | expand

Commit Message

Miaohe Lin June 27, 2020, 7:47 a.m. UTC
From: Miaohe Lin <linmiaohe@huawei.com>

We can't cast sk_buff to rtable by (struct rtable *)hint. Use skb_rtable().

Fixes: 02b24941619f ("ipv4: use dst hint for ipv4 list receive")

Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
---
 net/ipv4/route.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

David Miller June 28, 2020, 1:03 a.m. UTC | #1
From: linmiaohe <linmiaohe@huawei.com>
Date: Sat, 27 Jun 2020 15:47:51 +0800

> From: Miaohe Lin <linmiaohe@huawei.com>
> 
> We can't cast sk_buff to rtable by (struct rtable *)hint. Use skb_rtable().
> 
> Fixes: 02b24941619f ("ipv4: use dst hint for ipv4 list receive")
> 
> Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>

Please do not put empty lines between Fixes: and other tags.  All of the
tags belong together in a continuous uninterrupted sequence.

Applied and queued up for -stable, thank you.
diff mbox series

Patch

diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index 1d7076b78e63..a01efa062f6b 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -2027,7 +2027,7 @@  int ip_route_use_hint(struct sk_buff *skb, __be32 daddr, __be32 saddr,
 		      const struct sk_buff *hint)
 {
 	struct in_device *in_dev = __in_dev_get_rcu(dev);
-	struct rtable *rt = (struct rtable *)hint;
+	struct rtable *rt = skb_rtable(hint);
 	struct net *net = dev_net(dev);
 	int err = -EINVAL;
 	u32 tag = 0;