Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp1099181rdb; Wed, 6 Dec 2023 08:32:28 -0800 (PST) X-Google-Smtp-Source: AGHT+IEeBtgi7Rb1ir8XYz5PRhUEx5IV/zQ2dAyldEmfHriyE8T7ouMUKCncQ1VeTyAnZBszG7sT X-Received: by 2002:a05:6a20:244d:b0:18f:97c:4f44 with SMTP id t13-20020a056a20244d00b0018f097c4f44mr892099pzc.80.1701880348045; Wed, 06 Dec 2023 08:32:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701880348; cv=none; d=google.com; s=arc-20160816; b=Yo++Od0eJfmsFLFag1hVQUmhf2Prwgq1GtuSRv1DCa5cdMHwNL9AVohizOKZ6v52xZ xc+oYtzgTTwYNsOB8kdSKn6OdD94QeDpEBRQqBM3rEOQGWA+n7iIBWt0UoflVkdNA1w9 PwaJ142A0o1/QqX0bQFu59cdUGXFZ5+w1M33XCWD93WxbEVNaff/jxPq5uDHM/NngjjE BUE6Osoi1zDouwaWft/hNVCJZCN0UGQlBApKJXQh3IuVu35NYSO7O583QPYG2vA5jwS4 I5HXwOa9XAAmh1BT0G8Vthiiu50lbJ2fZMifodlnQGZCTOogbSppZVb3W8jNg+jsjFi7 4x3Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=fpWHSnwqX6HGw3nev19mj+TqZHsprVdc8TbYWfoKuUE=; fh=vnppsfPUyV+0qVOS0YfOLmsWV3qQfgTqTl3xbPf066M=; b=S8THtp404LxMc89cHTS3mZ+PSQTcK4DuMrpC3IPyAGAb+qoWXWUCyPoy6Ez1w3ND5F khwf9L2CnWv+sZow4JBRs9rInw5WT2SEYnX6y59H8ruND1BC14yAk5pZe1SuN2rYsKwU V36xBJL+6gSend7DttdsnYr8oytH8ewulD2aXG3sdpBUB8hx9iZPwVVZGOPecaooXAPi rabQP/+YpRNhYbWWJWGC9lrbHMVeoUf42rV/q3kPx1Vdp8Adu2CybvdCsIYY0FzyCV5Q MKlM3gO3HIPiYZVXMjRx8jlgARfMG4LG9BKbNDWnnnb8V/ESLj7lL9AOpobpBX/yL2AF WV7w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=hczI5Ffl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from howler.vger.email (howler.vger.email. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id e2-20020a654782000000b005b8ddb9c305si147142pgs.30.2023.12.06.08.32.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Dec 2023 08:32:28 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) client-ip=2620:137:e000::3:4; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=hczI5Ffl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id 8074E8343969; Wed, 6 Dec 2023 08:32:24 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1378351AbjLFQcG (ORCPT + 99 others); Wed, 6 Dec 2023 11:32:06 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44820 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1378338AbjLFQcF (ORCPT ); Wed, 6 Dec 2023 11:32:05 -0500 Received: from mail-pj1-x1029.google.com (mail-pj1-x1029.google.com [IPv6:2607:f8b0:4864:20::1029]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AE1EED5A for ; Wed, 6 Dec 2023 08:32:10 -0800 (PST) Received: by mail-pj1-x1029.google.com with SMTP id 98e67ed59e1d1-286c01bff06so421a91.1 for ; Wed, 06 Dec 2023 08:32:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1701880330; x=1702485130; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=fpWHSnwqX6HGw3nev19mj+TqZHsprVdc8TbYWfoKuUE=; b=hczI5FflWAyfvrcSjcRo8KE49yShQdAWyJc7PDYOufzjiksL0s4wFG34Jc8x7jg4jY 3IgvxZne3HgQHxHAIkt+lISSp3v1hw3uTky6+U+60Q2zR/rIRTJ7ueTcKSwjq0Bp1JC9 Ania92CEkCoL/daTmkCyiKVNJR0MqUWLCsFCI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701880330; x=1702485130; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=fpWHSnwqX6HGw3nev19mj+TqZHsprVdc8TbYWfoKuUE=; b=k62NLK/N1BncL4XlG8h1wOJHfrPnug2Rkx5KbxB+9mo/Wlm9pzvJJwuNlyPcBHTXFb 0pH7h+BQvFL9Yid98qkxGsJd/wpec3DMuDs/hb674Scis4MnGvQUyn1pEDimQxTHqq+A NdSbcGrMvLQwfRN0VL3cFR0i+KRdIKZkPV23N76Oq/robYM5eAc03nJJn5/MUuxunN7X ZLT9KAV9jankYxwxT+qbdFpbo7Huqs9ut7dg2Xe+CViy2GSLSKmmYimUuKpWiNd9rKPq QSYjuOcVeW1H+UjBdnYUNRi0DiRt8iMnA6XUDtedWsS2aHiGwChOgORwcyf+JSsRBX4L yQDQ== X-Gm-Message-State: AOJu0YzRDsYvsZVgpqBL7ROGB3nJpUzDA+mDA3b85+qbGuunZ5W/VggK GDIL+QPISbqR5Tyxp5XWcGrRXRURaBaGT6cM2xtEu2F1CTbzithz8R0= X-Received: by 2002:a17:90b:4f49:b0:286:b8a1:f1a2 with SMTP id pj9-20020a17090b4f4900b00286b8a1f1a2mr825338pjb.44.1701880330074; Wed, 06 Dec 2023 08:32:10 -0800 (PST) MIME-Version: 1.0 References: <20231206123719.1963153-1-revest@chromium.org> In-Reply-To: From: Florent Revest Date: Wed, 6 Dec 2023 17:31:58 +0100 Message-ID: Subject: Re: [PATCH] team: Fix use-after-free when an option instance allocation fails To: Hangbin Liu Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, jiri@resnulli.us, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, stable@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,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 howler.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 (howler.vger.email [0.0.0.0]); Wed, 06 Dec 2023 08:32:24 -0800 (PST) On Wed, Dec 6, 2023 at 4:05=E2=80=AFPM Hangbin Liu w= rote: > > On Wed, Dec 06, 2023 at 01:37:18PM +0100, Florent Revest 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 fro= m > > 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 mak= e > > 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: Hangbin Liu Thank you for the quick reviews Hangbin & Jiri, I appreciate! :) I just realized I forgot to CC stable (like I always do... :) maybe I should tattoo it on my arm) Let me know if you'd like a v2 adding: Cc: stable@vger.kernel.org