From nobody Mon Dec 15 11:23:41 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4F135C07E9D for ; Mon, 26 Sep 2022 11:47:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238814AbiIZLrq (ORCPT ); Mon, 26 Sep 2022 07:47:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42076 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238921AbiIZLpI (ORCPT ); Mon, 26 Sep 2022 07:45:08 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C3D7773939; Mon, 26 Sep 2022 03:47:06 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id F368460C13; Mon, 26 Sep 2022 10:31:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0B3CEC433D6; Mon, 26 Sep 2022 10:31:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664188307; bh=HopNTFdcmTqxm/bXN7v1c7b6TVs8bWw71xRLQwPXREQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ucWcPlSSvsXamq2BCgcrYmwHEIhXNkn+ad9V2XJWQ3Ex44Ax/3FwkZIHBUDOUAe/Y E7ihju4AHSOsT/v8yr6IPRUdME8RtCJHFFC/Eqow28dyLSAMGpn5P5aMu6XOKFCGpl 6U376K0GCtYDSLhAPPKhiog1x/+MmzOoYqjXky+A= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Florian Westphal , Sasha Levin , syzbot+a24c5252f3e3ab733464@syzkaller.appspotmail.com Subject: [PATCH 5.10 107/141] netfilter: ebtables: fix memory leak when blob is malformed Date: Mon, 26 Sep 2022 12:12:13 +0200 Message-Id: <20220926100758.314011924@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100754.639112000@linuxfoundation.org> References: <20220926100754.639112000@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Florian Westphal [ Upstream commit 62ce44c4fff947eebdf10bb582267e686e6835c9 ] The bug fix was incomplete, it "replaced" crash with a memory leak. The old code had an assignment to "ret" embedded into the conditional, restore this. Fixes: 7997eff82828 ("netfilter: ebtables: reject blobs that don't provide = all entry points") Reported-and-tested-by: syzbot+a24c5252f3e3ab733464@syzkaller.appspotmail.c= om Signed-off-by: Florian Westphal Signed-off-by: Sasha Levin --- net/bridge/netfilter/ebtables.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/net/bridge/netfilter/ebtables.c b/net/bridge/netfilter/ebtable= s.c index 310740cc684a..06b80b584381 100644 --- a/net/bridge/netfilter/ebtables.c +++ b/net/bridge/netfilter/ebtables.c @@ -999,8 +999,10 @@ static int do_replace_finish(struct net *net, struct e= bt_replace *repl, goto free_iterate; } =20 - if (repl->valid_hooks !=3D t->valid_hooks) + if (repl->valid_hooks !=3D t->valid_hooks) { + ret =3D -EINVAL; goto free_unlock; + } =20 if (repl->num_counters && repl->num_counters !=3D t->private->nentries) { ret =3D -EINVAL; --=20 2.35.1