From patchwork Sat Aug 12 12:04:33 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Phil Sutter X-Patchwork-Id: 800851 X-Patchwork-Delegate: shemminger@vyatta.com Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3xV0tv6jFZz9t3C for ; Sat, 12 Aug 2017 22:05:27 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752371AbdHLMFY (ORCPT ); Sat, 12 Aug 2017 08:05:24 -0400 Received: from orbyte.nwl.cc ([151.80.46.58]:46719 "EHLO mail.nwl.cc" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752361AbdHLMFW (ORCPT ); Sat, 12 Aug 2017 08:05:22 -0400 Received: from mail.nwl.cc (orbyte.nwl.cc [127.0.0.1]) by mail.nwl.cc (Postfix) with ESMTP id 8A47B68252; Sat, 12 Aug 2017 14:05:21 +0200 (CEST) Received: from xsao (localhost [IPv6:::1]) by mail.nwl.cc (Postfix) with ESMTP id 66F52681D7; Sat, 12 Aug 2017 14:05:21 +0200 (CEST) From: Phil Sutter To: Stephen Hemminger Cc: netdev@vger.kernel.org Subject: [iproute PATCH 14/51] ipvrf: Don't try to close an invalid fd Date: Sat, 12 Aug 2017 14:04:33 +0200 Message-Id: <20170812120510.28750-15-phil@nwl.cc> X-Mailer: git-send-email 2.13.1 In-Reply-To: <20170812120510.28750-1-phil@nwl.cc> References: <20170812120510.28750-1-phil@nwl.cc> X-Virus-Scanned: ClamAV using ClamSMTP Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Signed-off-by: Phil Sutter Acked-by: David Ahern --- ip/ipvrf.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/ip/ipvrf.c b/ip/ipvrf.c index 0094cf8557cd7..92e2db98ca7d7 100644 --- a/ip/ipvrf.c +++ b/ip/ipvrf.c @@ -268,7 +268,7 @@ static int vrf_configure_cgroup(const char *path, int ifindex) fprintf(stderr, "Failed to open cgroup path: '%s'\n", strerror(errno)); - goto out; + return rc; } /* @@ -290,13 +290,14 @@ static int vrf_configure_cgroup(const char *path, int ifindex) if (bpf_prog_attach_fd(prog_fd, cg_fd, BPF_CGROUP_INET_SOCK_CREATE)) { fprintf(stderr, "Failed to attach prog to cgroup: '%s'\n", strerror(errno)); - goto out; + goto out2; } rc = 0; +out2: + close(prog_fd); out: close(cg_fd); - close(prog_fd); return rc; }