Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp968733rdb; Wed, 6 Dec 2023 05:21:44 -0800 (PST) X-Google-Smtp-Source: AGHT+IE6q5/9eAVQQXIGJ75bYxWSe0Q5A+K+UK3ACyzHcmd02HOF7qkkhjHwTPAl4fw6eZZpItZG X-Received: by 2002:a05:6a20:841f:b0:148:f952:552b with SMTP id c31-20020a056a20841f00b00148f952552bmr1142081pzd.51.1701868904589; Wed, 06 Dec 2023 05:21:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701868904; cv=none; d=google.com; s=arc-20160816; b=YjsTPhQpX19fNNuOrq3QyVF1Bnyf4SQ5Y2byJNTdm4enL0Qm77TVT9lwfC+/o1JtUu bE6PQPjF6yyuBwwWOn+WIyr04OO41tZiD2J7Pv1QKb19JXpIxGG2a+2owglpjg0zQuTN FX9NmJaln7eEgtArGabsmg+wz0XCECH68TTrXl0Vp2jwT3m375oYNVxS4Yzax90OFj8Z T5TGfC2BTjjpJATvg+Q1AO7ek9SCK7jxtqeVWfA3PE6LOAnYR6Je/nq2dSDj8ziN/CNo SucvpQT7t/jA6nHYHkSxwzfy6EuI/8+6Mw7t9v54tveJHS7IR2N2trqUEvjj2aQHeVMz lhrA== 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=RwQqJumbY5/om6bDdbaAXe1etwBjyfBaS/JPDxfOUVo=; fh=ESxyvWmX52jjcEh9MyazSkhH+UHAi0OdL5esBg8a/B0=; b=DajdHaM20QHiw4sON980Rz22Hhd1TTwTZX8vnLaCCY0o2vBYzQIYTcdCO2k+6TsV/y zgxFQE1WrqH4FSjbu8CUIyf9uDWw0Cr/eU8/B2U0tdbRh/Wf9iv+3nn+pfkxTsnK15vF HYglkb8Q/X62inu624qoPrXZfTiez+hBI7DbqqwrGWsOu8Gq+XQneOXm0K9mprzQ9ZOz F6Qwnr9xHwXu9t0liqE+ry0WVmjbvmAlnBhRpfgFzulqHxd3gaysQ/1ZDO2DmUH/+370 liv7Rk+ukmIlM71a99jMWcKn4EseBZEBoepRfEH8wWs0ugHLoX4KyLJ6cGNx7VEtDJuu 864A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@resnulli-us.20230601.gappssmtp.com header.s=20230601 header.b=cfS90Op1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id p35-20020a056a0026e300b006ce79a76cb0si2112632pfw.137.2023.12.06.05.21.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Dec 2023 05:21:44 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; dkim=pass header.i=@resnulli-us.20230601.gappssmtp.com header.s=20230601 header.b=cfS90Op1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id A1F0080C6EB0; Wed, 6 Dec 2023 05:21:40 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1378468AbjLFNVY (ORCPT + 99 others); Wed, 6 Dec 2023 08:21:24 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54514 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1378416AbjLFNVW (ORCPT ); Wed, 6 Dec 2023 08:21:22 -0500 Received: from mail-ed1-x52f.google.com (mail-ed1-x52f.google.com [IPv6:2a00:1450:4864:20::52f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CB25090 for ; Wed, 6 Dec 2023 05:21:27 -0800 (PST) Received: by mail-ed1-x52f.google.com with SMTP id 4fb4d7f45d1cf-54c4f95e27fso5436317a12.1 for ; Wed, 06 Dec 2023 05:21:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=resnulli-us.20230601.gappssmtp.com; s=20230601; t=1701868886; x=1702473686; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=RwQqJumbY5/om6bDdbaAXe1etwBjyfBaS/JPDxfOUVo=; b=cfS90Op1KcpjwNwmV+pclQzzd1+JNvKPci3FxhuImaxINNxKtlV5Tx6u4IsxPI2sSG a1r7caH5O3TnwbHN2ivlVEjSd3s8ULEo/vh1nOvbLv+Z8OFySMBZ1hzUweuygrP+RYKI PoE7gFH5Ub+RFRgqs87lNhqnpi2V3lcBhERj90johk128tvIcvxTTNaKhh2LWboQoaLz ECjhsZbZGLxvI9Hb7LkrhZEcnqVFBebCk8OW4wFfkVI5NgnvsL617mbx72CIdgZLcdSl Ah0Ct/hu7QbU5toWbhCBKsSHL/uEFoAR3lbRoCCPVPpzucuTzAG8iCuDmlA5y6ODe6hs Llog== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701868886; x=1702473686; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=RwQqJumbY5/om6bDdbaAXe1etwBjyfBaS/JPDxfOUVo=; b=osZGlCkcn7iRJEks4fC5LQQONd8rka1rwwGRxOT4FkoneKAFe+p4A08S6KPUEzp+Ui yUKK+XRakxN6/3ChqHTncWjhn9X0xSNLrPFARhIErypBTbeWHOMOZK9WC5D3B7wb9Dlq 4dRsWCOXLDq1t4P3gxNGow6ylGb5oakGbt5WGHzqg3vIgK3PSy88sSyt7WPg5oeKJSzY Qmyq2WdL8utQQ+XBrtzv53uLeZqFgEpKIJ5pgezWpHjMjGh6GxtnW+KVP5aHrpkDKPpi ifTJ6Wj5iLiL/9R7kPlKhHeOJOxCH9ZOfTxjWN0I3PXX5Z02ryFX7a4pEXGHyMNPWhIG j9iQ== X-Gm-Message-State: AOJu0YzPllca7n61tVTn2tKzEPBxyzLvs67ze40uNm/MENVBJ4D3x9Vn gxauQhhnF5/ra7Nrmt5rBWrG7A== X-Received: by 2002:a05:6402:3185:b0:54c:4837:9035 with SMTP id di5-20020a056402318500b0054c48379035mr734306edb.45.1701868885946; Wed, 06 Dec 2023 05:21:25 -0800 (PST) Received: from localhost (host-213-179-129-39.customer.m-online.net. [213.179.129.39]) by smtp.gmail.com with ESMTPSA id s7-20020aa7c547000000b0054cb199600fsm2404810edr.67.2023.12.06.05.21.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Dec 2023 05:21:25 -0800 (PST) Date: Wed, 6 Dec 2023 14:21:24 +0100 From: Jiri Pirko To: Florent Revest Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com Subject: Re: [PATCH] team: Fix use-after-free when an option instance allocation fails Message-ID: References: <20231206123719.1963153-1-revest@chromium.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231206123719.1963153-1-revest@chromium.org> X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Wed, 06 Dec 2023 05:21:40 -0800 (PST) Wed, Dec 06, 2023 at 01:37:18PM CET, revest@chromium.org wrote: >In __team_options_register, team_options are allocated and appended to >the team's option_list. >If one option instance allocation fails, the "inst_rollback" cleanup >path frees the previously allocated options but doesn't remove them from >the team's option_list. >This leaves dangling pointers that can be dereferenced later by other >parts of the team driver that iterate over options. > >This patch fixes the cleanup path to remove the dangling pointers from >the list. > >As far as I can tell, this uaf doesn't have much security implications >since it would be fairly hard to exploit (an attacker would need to make >the allocation of that specific small object fail) but it's still nice >to fix. > >Fixes: 80f7c6683fe0 ("team: add support for per-port options") >Signed-off-by: Florent Revest Reviewed-by: Jiri Pirko Thanks!