lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Mon, 7 Aug 2023 13:17:33 -0700
From: Kuniyuki Iwashima <kuniyu@...zon.com>
To: <xu.xin.sc@...il.com>
CC: <davem@...emloft.net>, <dsahern@...nel.org>, <kuba@...nel.org>,
	<linux-kernel@...r.kernel.org>, <netdev@...r.kernel.org>,
	<pabeni@...hat.com>, <si.hao@....com.cn>, <xu.xin16@....com.cn>,
	<yang.yang29@....com.cn>, <kuniyu@...zon.com>
Subject: Re: [PATCH linux-next v2] net/ipv4: return the real errno instead of -EINVAL

From:   xu.xin.sc@...il.com
Date:   Mon,  7 Aug 2023 01:54:08 +0000
> From: xu xin <xu.xin16@....com.cn>
> 
> For now, No matter what error pointer ip_neigh_for_gw() returns,
> ip_finish_output2() always return -EINVAL, which may mislead the upper
> users.
> 
> For exemple, an application uses sendto to send an UDP packet, but when the
> neighbor table overflows, sendto() will get a value of -EINVAL, and it will
> cause users to waste a lot of time checking parameters for errors.
> 
> Return the real errno instead of -EINVAL.
> 
> Signed-off-by: xu xin <xu.xin16@....com.cn>
> Reviewed-by: Yang Yang <yang.yang29@....com.cn>

Recently I was also investigating a similar issue that ip_finish_output2()
returned the fixed -EINVAL.  But in my case, arp_constructor() failed with
-EINVAL, and ___neigh_create() returned ERR_PTR(-EINVAL);

So, there are still confusing paths even with this patch though, the change
would be useful.

Reviewed-by: Kuniyuki Iwashima <kuniyu@...zon.com>

Thanks!


> Cc: Si Hao <si.hao@....com.cn>
> ---
>  net/ipv4/ip_output.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c
> index 6ba1a0fafbaa..f28c87533a46 100644
> --- a/net/ipv4/ip_output.c
> +++ b/net/ipv4/ip_output.c
> @@ -236,7 +236,7 @@ static int ip_finish_output2(struct net *net, struct sock *sk, struct sk_buff *s
>  	net_dbg_ratelimited("%s: No header cache and no neighbour!\n",
>  			    __func__);
>  	kfree_skb_reason(skb, SKB_DROP_REASON_NEIGH_CREATEFAIL);
> -	return -EINVAL;
> +	return PTR_ERR(neigh);
>  }
>  
>  static int ip_finish_output_gso(struct net *net, struct sock *sk,
> -- 
> 2.15.2

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ