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:	Thu, 2 Jan 2014 08:42:57 +0100
From:	Petr Pisar <ppisar@...hat.com>
To:	netdev@...r.kernel.org
Cc:	Stephen Hemminger <stephen@...workplumber.org>
Subject: Re: [PATCH] Do not listen if rtnl_send() fails in ip link
 iplink_have_newlink() test

On Fri, Dec 20, 2013 at 08:21:07AM -0800, Stephen Hemminger wrote:
> I took your idea and enhanced it to all of iproute2 by doing the following:
> 
> From c4b6330a3a033bd9c9b0664c5f844493137ae599 Mon Sep 17 00:00:00 2001
> From: Stephen Hemminger <stephen@...workplumber.org>
> Date: Fri, 20 Dec 2013 08:15:02 -0800
> Subject: [PATCH] check return value of rtnl_send and related functions
> MIME-Version: 1.0
> Content-Type: text/plain; charset=UTF-8
> Content-Transfer-Encoding: 8bit
> 
> Use warn_unused_result to enforce checking return value of rtnl_send,
> and fix where the errors are.
> 
[...]
> diff --git a/ip/iplink.c b/ip/iplink.c
> index 58b6c20..e0c14e6 100644
> --- a/ip/iplink.c
> +++ b/ip/iplink.c
> @@ -178,7 +178,10 @@ static int iplink_have_newlink(void)
>  		req.n.nlmsg_type = RTM_NEWLINK;
>  		req.i.ifi_family = AF_UNSPEC;
>  
> -		rtnl_send(&rth, &req.n, req.n.nlmsg_len);
> +		if (rtnl_send(&rth, &req.n, req.n.nlmsg_len) < 0) {
> +			perror("request send failed");
> +			exit(1);
> +		}
>  		rtnl_listen(&rth, accept_msg, NULL);
>  	}
>  	return have_rtnl_newlink;

This one exits instead of falling back to IOCTL. iplink_have_newlink() is
called even from iplink_usage(). This even prevents from printing usage.

I think failure in this very place should be treated as I suggested.

-- Petr

Content of type "application/pgp-signature" skipped

Powered by blists - more mailing lists