[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20131211105749.1ee87844@nehalam.linuxnetplumber.net>
Date: Wed, 11 Dec 2013 10:57:49 -0800
From: Stephen Hemminger <stephen@...workplumber.org>
To: Petr Písař <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 Wed, 11 Dec 2013 14:01:29 +0100
Petr Písař <ppisar@...hat.com> wrote:
> If rtnl_send() fails in iplink_have_newlink() test, listening for
> response will result in indefinite hang. This can be demonstrated by
> "ip link show" while SELinux preventing from sending the RTM_NEWLINK
> over netlink.
>
> This patch checks for the return value as is done at all other
> rtnl_send() calls.
>
> Signed-off-by: Petr Písař <ppisar@...hat.com>
> ---
> ip/iplink.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/ip/iplink.c b/ip/iplink.c
> index 58b6c20..f7d9e17 100644
> --- a/ip/iplink.c
> +++ b/ip/iplink.c
> @@ -178,8 +178,8 @@ 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);
> - rtnl_listen(&rth, accept_msg, NULL);
> + if (rtnl_send(&rth, &req.n, req.n.nlmsg_len) >= 0)
> + rtnl_listen(&rth, accept_msg, NULL);
> }
> return have_rtnl_newlink;
> }
I think it should print an error messag, not silently ignore the send failure.
--
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