Received: by 2002:a05:6a10:2785:0:0:0:0 with SMTP id ia5csp21527pxb; Fri, 15 Jan 2021 04:55:34 -0800 (PST) X-Google-Smtp-Source: ABdhPJxWdz0uJNGiN8il+pZrWli4UEFypfTzhv6RhhZQXTsulzpsdp1n72OFSEFVqo4dUmzDCLOC X-Received: by 2002:aa7:ca55:: with SMTP id j21mr9253066edt.172.1610715333799; Fri, 15 Jan 2021 04:55:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1610715333; cv=none; d=google.com; s=arc-20160816; b=O4P5ID5e630/VmzDdEt5n8QihP3dWJOVbLHKyZf4ptvf2SCJLG0qCoVUH9/+XDrzmN lT1rrVlEJ2L28+26tsfZ5zA0qyectYVAyrEcsEGqQMo5hIr7ppbJutyqI7N9y3cqzQaM LGWGGEeAWDwzAzFveZixDminjI4J+3V4gtt3ogLbjnLcCqjVdTOwrmpwD1l05hAZSwoL f37IaSZAM4S6TBA1Qya/Bn8g29RZcTcd4N9c/bmkfQA6vnC5ZFhfORJZ+kJmqUEmxLiT hgRITW7wlPmpdJGfBm7g0wA+0EcCvpEMsQwPa1JU5TK8huDbVAO1kNjpCNWP5TKM1bHt pQ7g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=+BkNvNLqnTYHSA7VQ5qwQZwkJ4cGfxPsEU7724EsfQ8=; b=FSJmDJdHVyrp9wmNtdihOA1JRwzPiqLlZ2JRPTHImu37KnIs+O06cW7mtyvHu4kQP4 a/93WEA2VRxNTDrz4mmpjVorew+zJuUK2aC53VGlRqye+bFtc+A9AsBmL/m//TceYdVw kGmPbNKhNVcGdYy8c0TJh/x1o5ZeZuN2wFgM7b97s0Ci/wvT2wWieJNyvnZ1bExezLwH 9oDxkMn0IBEeAt/KZITmjbtzol17gFcezhhNwqSwzaeQrnCYnvrs9FrzZ2Fj8wc607Mx Q2e11SjB9VZ0ujbmptYcx31VQPTULmwticUA6Zzz5CwA2uPmH2qHC7dRT5Pujm+RF3xv t+KA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=eUKFXVol; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id cs10si3255524ejc.200.2021.01.15.04.54.55; Fri, 15 Jan 2021 04:55:33 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=eUKFXVol; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387762AbhAOMx6 (ORCPT + 99 others); Fri, 15 Jan 2021 07:53:58 -0500 Received: from mail.kernel.org ([198.145.29.99]:42702 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387715AbhAOMfj (ORCPT ); Fri, 15 Jan 2021 07:35:39 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 5A48923403; Fri, 15 Jan 2021 12:34:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1610714098; bh=jMzdF+RfhOwPd12eKVLrou4uv5cLdTnsfpiQ/dr7TyI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eUKFXVol2TMgZ+Qt9sI7t1FwybaAhz0HShRTsoAJl6JfLP8Oq2TT1WZ8T9PC0CueB eGgayDaV9AQlGDq6E2G4pt8sFPtyef1ZrdEyDBCZIphQxN5NThb/1KxllDJDnJ532c JVNESqzpBXWZAP7xiMb08MivC/3Eqtt7Ra7uElV8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ido Schimmel , Petr Machata , David Ahern , Jakub Kicinski Subject: [PATCH 5.4 15/62] nexthop: Fix off-by-one error in error path Date: Fri, 15 Jan 2021 13:27:37 +0100 Message-Id: <20210115121959.143541197@linuxfoundation.org> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210115121958.391610178@linuxfoundation.org> References: <20210115121958.391610178@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Ido Schimmel [ Upstream commit 07e61a979ca4dddb3661f59328b3cd109f6b0070 ] A reference was not taken for the current nexthop entry, so do not try to put it in the error path. Fixes: 430a049190de ("nexthop: Add support for nexthop groups") Signed-off-by: Ido Schimmel Reviewed-by: Petr Machata Reviewed-by: David Ahern Signed-off-by: Jakub Kicinski Signed-off-by: Greg Kroah-Hartman --- net/ipv4/nexthop.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/net/ipv4/nexthop.c +++ b/net/ipv4/nexthop.c @@ -1157,7 +1157,7 @@ static struct nexthop *nexthop_create_gr return nh; out_no_nh: - for (; i >= 0; --i) + for (i--; i >= 0; --i) nexthop_put(nhg->nh_entries[i].nh); kfree(nhg->spare);