Received: by 2002:a05:6358:c692:b0:131:369:b2a3 with SMTP id fe18csp5433753rwb; Tue, 1 Aug 2023 02:26:20 -0700 (PDT) X-Google-Smtp-Source: APBJJlFjAQ4zQ3oqKWbu47MDxYiYbLM42ygy+3Jz8eoK9cEA+SD03mSfk7Ip/DDzTCczzByp/mcV X-Received: by 2002:a17:906:2102:b0:99b:ed8d:de4 with SMTP id 2-20020a170906210200b0099bed8d0de4mr2001559ejt.20.1690881980434; Tue, 01 Aug 2023 02:26:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690881980; cv=none; d=google.com; s=arc-20160816; b=NTAzGcKuh2tNZ26/G+nnaQDBR1dx9idIN8yOU010XJihFt3L0ntah60nfq2SrqbQMT hPrgTDeFsm7HfCizO37/A1dDGRpD5f1XGc5245GZxCLmdvyj3yozZDNDQuZcUP2HXEmc pNCvJ1Y7YyYinSsX7NGcE7crMhR3ouBxdZB87ZQ2/W+FZ7ve2rTS7lTHuwqy8VmynoLk lMZxoT/27XsP/s51vEA+Pe2iYhXyL/zm9q1tYKSPjBoF2qKAPSX/4iZkHnxGNLv25iFq 7fMFcDUjmv4B58GaloGVafG4RFil4S9CjLKLITrOax7EpCYd+jIRWy7r4R5jtg/yuVz0 g3mA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=P5sZ8YmZCvRFW9s3wg8alROD+pmbYzm95sbjIPk0aSI=; fh=qPVLBFDzmJ17yRnTFYc56pKHdqZrNzX8EzQgpY06FmU=; b=01de4ge+gXYQT585IFafBiGt7/Si1vtagIdz60a4VL8Evfm2zxRqqPIUIgI9Czbfc4 FjllWi35/R7/tkSo1xU5VaL35+l4FKvfOsl/1gME872JvgTRpSaKUTqXSMwoxTfkAR+R YwDkJTpZq8xwpuEusHz0iQTzvAnfGmK94r5OiBTAZZfBrVE+UcCb5aZrBoe08c2+Rr1m KZBml4lBXSnR6zFI+PflK5CgOQ5Lxi/pS0rDRdAqihayWYjtvNpomX16qduQsXrb/6v2 py/TmdoS9GgVqNQFGjEUzZvB3NNCLCL8WveRp+akunfIzQs+r80SoSzSkXv/dKt/CSNr ERXg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=h44OEA5U; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a17-20020a1709062b1100b0098e1c7a62casi7814657ejg.334.2023.08.01.02.25.56; Tue, 01 Aug 2023 02:26:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=h44OEA5U; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S230262AbjHAIVT (ORCPT + 99 others); Tue, 1 Aug 2023 04:21:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38954 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229866AbjHAIVS (ORCPT ); Tue, 1 Aug 2023 04:21:18 -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 22E5D1AD; Tue, 1 Aug 2023 01:21:17 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 9A21D614B1; Tue, 1 Aug 2023 08:21:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 73AFFC433C8; Tue, 1 Aug 2023 08:21:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1690878076; bh=SdSpzQrfWhfHyrXQhEcCm9xTj2Z7bwVFrrUBGSfQ6jE=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=h44OEA5UrUyZLkbqP0xodxVwaBmCmf+8GcZO402BbcusWHfvdSiqb8Krd8BncNsrS dOfNuPvvR9TJOOl2qIqa6e5GaZkz7iUFi/V8f7CabPalqmVeVhuTJ8jUquY7d7htAy N3s0MSMa5h9+N/p8XYF9LlTZCgKutfsIQfiJQAzM= Date: Tue, 1 Aug 2023 10:21:13 +0200 From: Greg KH To: SeongJae Park Cc: stable@vger.kernel.org, M A Ramdhan , sashal@kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, hailmo@amazon.com, Jamal Hadi Salim , Pedro Tammela , Jakub Kicinski Subject: Re: [PATCH 4.19] net/sched: cls_fw: Fix improper refcount update leads to use-after-free Message-ID: <2023080159-status-barracuda-99dd@gregkh> References: <20230727174629.55740-1-sj@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230727174629.55740-1-sj@kernel.org> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jul 27, 2023 at 05:46:28PM +0000, SeongJae Park wrote: > From: M A Ramdhan > > [ Upstream commit 0323bce598eea038714f941ce2b22541c46d488f ] > > In the event of a failure in tcf_change_indev(), fw_set_parms() will > immediately return an error after incrementing or decrementing > reference counter in tcf_bind_filter(). If attacker can control > reference counter to zero and make reference freed, leading to > use after free. > > In order to prevent this, move the point of possible failure above the > point where the TC_FW_CLASSID is handled. > > Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") > Reported-by: M A Ramdhan > Signed-off-by: M A Ramdhan > Acked-by: Jamal Hadi Salim > Reviewed-by: Pedro Tammela > Message-ID: <20230705161530.52003-1-ramdhan@starlabs.sg> > Signed-off-by: Jakub Kicinski > Signed-off-by: SeongJae Park > --- > net/sched/cls_fw.c | 10 +++++----- Both now queued up, thanks. greg k-h