* [PATCH net] ipv4: Don't override return code from ip_route_input_noref()
@ 2017-08-31 16:11 Stefano Brivio
2017-08-31 16:39 ` Wei Wang
2017-08-31 23:45 ` Sabrina Dubroca
0 siblings, 2 replies; 4+ messages in thread
From: Stefano Brivio @ 2017-08-31 16:11 UTC (permalink / raw)
To: David S . Miller, netdev; +Cc: Sabrina Dubroca, Wei Wang
After ip_route_input() calls ip_route_input_noref(), another
check on skb_dst() is done, but if this fails, we shouldn't
override the return code from ip_route_input_noref(), as it
could have been more specific (i.e. -EHOSTUNREACH).
This also saves one call to skb_dst_force_safe() and one to
skb_dst() in case the ip_route_input_noref() check fails.
Reported-by: Sabrina Dubroca <sdubroca@redhat.com>
Fixes: ad65a2f05695 ("ipv4: call dst_hold_safe() properly")
Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
---
include/net/route.h | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/include/net/route.h b/include/net/route.h
index cb0a76d9dde1..1b09a9368c68 100644
--- a/include/net/route.h
+++ b/include/net/route.h
@@ -189,10 +189,11 @@ static inline int ip_route_input(struct sk_buff *skb, __be32 dst, __be32 src,
rcu_read_lock();
err = ip_route_input_noref(skb, dst, src, tos, devin);
- if (!err)
+ if (!err) {
skb_dst_force_safe(skb);
- if (!skb_dst(skb))
- err = -EINVAL;
+ if (!skb_dst(skb))
+ err = -EINVAL;
+ }
rcu_read_unlock();
return err;
--
2.9.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH net] ipv4: Don't override return code from ip_route_input_noref()
2017-08-31 16:11 [PATCH net] ipv4: Don't override return code from ip_route_input_noref() Stefano Brivio
@ 2017-08-31 16:39 ` Wei Wang
2017-08-31 23:45 ` Sabrina Dubroca
1 sibling, 0 replies; 4+ messages in thread
From: Wei Wang @ 2017-08-31 16:39 UTC (permalink / raw)
To: Stefano Brivio
Cc: David S . Miller, Linux Kernel Network Developers, Sabrina Dubroca
> After ip_route_input() calls ip_route_input_noref(), another
> check on skb_dst() is done, but if this fails, we shouldn't
> override the return code from ip_route_input_noref(), as it
> could have been more specific (i.e. -EHOSTUNREACH).
>
> This also saves one call to skb_dst_force_safe() and one to
> skb_dst() in case the ip_route_input_noref() check fails.
>
> Reported-by: Sabrina Dubroca <sdubroca@redhat.com>
> Fixes: ad65a2f05695 ("ipv4: call dst_hold_safe() properly")
> Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
Acked-by: Wei Wang <weiwan@google.com>
On Thu, Aug 31, 2017 at 9:11 AM, Stefano Brivio <sbrivio@redhat.com> wrote:
> After ip_route_input() calls ip_route_input_noref(), another
> check on skb_dst() is done, but if this fails, we shouldn't
> override the return code from ip_route_input_noref(), as it
> could have been more specific (i.e. -EHOSTUNREACH).
>
> This also saves one call to skb_dst_force_safe() and one to
> skb_dst() in case the ip_route_input_noref() check fails.
>
> Reported-by: Sabrina Dubroca <sdubroca@redhat.com>
> Fixes: ad65a2f05695 ("ipv4: call dst_hold_safe() properly")
> Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
> ---
> include/net/route.h | 7 ++++---
> 1 file changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/include/net/route.h b/include/net/route.h
> index cb0a76d9dde1..1b09a9368c68 100644
> --- a/include/net/route.h
> +++ b/include/net/route.h
> @@ -189,10 +189,11 @@ static inline int ip_route_input(struct sk_buff *skb, __be32 dst, __be32 src,
>
> rcu_read_lock();
> err = ip_route_input_noref(skb, dst, src, tos, devin);
> - if (!err)
> + if (!err) {
> skb_dst_force_safe(skb);
> - if (!skb_dst(skb))
> - err = -EINVAL;
> + if (!skb_dst(skb))
> + err = -EINVAL;
> + }
> rcu_read_unlock();
>
> return err;
> --
> 2.9.4
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH net] ipv4: Don't override return code from ip_route_input_noref()
2017-08-31 16:11 [PATCH net] ipv4: Don't override return code from ip_route_input_noref() Stefano Brivio
2017-08-31 16:39 ` Wei Wang
@ 2017-08-31 23:45 ` Sabrina Dubroca
2017-09-03 17:55 ` David Miller
1 sibling, 1 reply; 4+ messages in thread
From: Sabrina Dubroca @ 2017-08-31 23:45 UTC (permalink / raw)
To: Stefano Brivio; +Cc: David S . Miller, netdev, Wei Wang
2017-08-31, 18:11:41 +0200, Stefano Brivio wrote:
> After ip_route_input() calls ip_route_input_noref(), another
> check on skb_dst() is done, but if this fails, we shouldn't
> override the return code from ip_route_input_noref(), as it
> could have been more specific (i.e. -EHOSTUNREACH).
>
> This also saves one call to skb_dst_force_safe() and one to
> skb_dst() in case the ip_route_input_noref() check fails.
>
> Reported-by: Sabrina Dubroca <sdubroca@redhat.com>
> Fixes: ad65a2f05695 ("ipv4: call dst_hold_safe() properly")
That should be instead:
Fixes: 9df16efadd2a ("ipv4: call dst_hold_safe() properly")
Acked-by: Sabrina Dubroca <sd@queasysnail.net>
--
Sabrina
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH net] ipv4: Don't override return code from ip_route_input_noref()
2017-08-31 23:45 ` Sabrina Dubroca
@ 2017-09-03 17:55 ` David Miller
0 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2017-09-03 17:55 UTC (permalink / raw)
To: sd; +Cc: sbrivio, netdev, weiwan
From: Sabrina Dubroca <sd@queasysnail.net>
Date: Fri, 1 Sep 2017 01:45:06 +0200
> 2017-08-31, 18:11:41 +0200, Stefano Brivio wrote:
>> After ip_route_input() calls ip_route_input_noref(), another
>> check on skb_dst() is done, but if this fails, we shouldn't
>> override the return code from ip_route_input_noref(), as it
>> could have been more specific (i.e. -EHOSTUNREACH).
>>
>> This also saves one call to skb_dst_force_safe() and one to
>> skb_dst() in case the ip_route_input_noref() check fails.
>>
>> Reported-by: Sabrina Dubroca <sdubroca@redhat.com>
>> Fixes: ad65a2f05695 ("ipv4: call dst_hold_safe() properly")
>
> That should be instead:
>
> Fixes: 9df16efadd2a ("ipv4: call dst_hold_safe() properly")
>
> Acked-by: Sabrina Dubroca <sd@queasysnail.net>
Applied with fixed Fixes: tag, thanks.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2017-09-03 17:55 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-08-31 16:11 [PATCH net] ipv4: Don't override return code from ip_route_input_noref() Stefano Brivio
2017-08-31 16:39 ` Wei Wang
2017-08-31 23:45 ` Sabrina Dubroca
2017-09-03 17:55 ` David Miller
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.