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] [day] [month] [year] [list]
Message-ID: <20140103123605.07468944@nehalam.linuxnetplumber.net>
Date:	Fri, 3 Jan 2014 12:36:05 -0800
From:	Stephen Hemminger <stephen@...workplumber.org>
To:	Petr Pisar <ppisar@...hat.com>
Cc:	netdev@...r.kernel.org
Subject: Re: [PATCH] Do not listen if rtnl_send() fails in ip link
 iplink_have_newlink() test

On Thu, 2 Jan 2014 08:42:57 +0100
Petr Pisar <ppisar@...hat.com> wrote:

> 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

The code gets used in multiple paths, some should fail and others have
fallback. I will fix the cases where fallback is possible.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ