Received: by 2002:ab2:3141:0:b0:1ed:23cc:44d1 with SMTP id i1csp1926008lqg; Mon, 4 Mar 2024 07:51:19 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVLClbTLQPszv9MgtI7A7zdcFwMuAr5i2RgDdZpGXn4odZOZakxXUJblbmPHApxU4nSaFI6GqhjLxmynMou6dIWVnD2wSnn/1jzCa5TIA== X-Google-Smtp-Source: AGHT+IHPqC5em96S+qraEGUT47PdqIhCzXmxvWnxK6OX8p1pp2OcsYseDPxQf9oW7fWvqD5eLZqq X-Received: by 2002:a05:6a20:d397:b0:1a0:8319:a0be with SMTP id iq23-20020a056a20d39700b001a08319a0bemr18996530pzb.7.1709567479296; Mon, 04 Mar 2024 07:51:19 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709567479; cv=pass; d=google.com; s=arc-20160816; b=jYYrrB6wwoYW9b+PdN9rN8EVS0/Uque3z3RemxeL9o2ZaE5oxLYQrXcGMS0uOKWCKZ jdygRKNvmgJg1zRSx3MsKZEuiOC2jVJqdkssYBVW2B+p9yvdNG1x0MiNdar5Dl491Ueu mPwlyKV/a/22jNaXMaKs2d/ZOf6H8aWMIk3NHJIBFV/MyL7er2H70veUZbDTdfoPyGDA BoIbxHeHI63PZmtUrSs8UzcI5fSrqCdsKu7o+0lM5W6SgrW5IYGk0EofnStY/5kxTKGl qw+2apIfj83EhBh9F7yKI2PhdJ/LALcMPX7rlbNlk8WjqeK8N+ejskwKJXXQEhSSKIdO 06KA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=ZM3m2QCRTCfxm8sG9p+HIQuOei4EDJKr+hamsNFmouw=; fh=yN9jgCXSMWrf0CBLPsj6V7uMspGM2q2p9spv+S4ygmQ=; b=IVKtrwkqkQxtByQtwVfzKxf4pEwleXK5ossRmC0IObR3YfupUkVxPHfvxQqQuSPzfE 8mGr/vf7+8/G18ByE/vxO65CHewAjcaQHCqLFz3EB+xPIuEJEylTgnd1GKTyaN2Xq8Ri Afs+mp3SHCsWhPI7tdPTV3k/dGNH/JUuqjZkLXDbh/0Ozntvrg0Ad6hsBkqRTd5zPApg Jcq50OU2d9Hvq369HgIfQSIiCTzK8HF9FQnZr4asbAovfAG0h6KMxSTnYL4Yi+GbU79J JgBrhuLRm+SnCehv8JjX5h6vrbsRCksLivySgKe6RhjJp8nhYkbOnoNQbA+dEgRFs4Oc CwPw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=TRimCEW3; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-90878-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-90878-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id d2-20020a63bd42000000b005dbec91be93si8448501pgp.595.2024.03.04.07.51.19 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Mar 2024 07:51:19 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-90878-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=TRimCEW3; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-90878-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-90878-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 4466D285007 for ; Mon, 4 Mar 2024 15:50:40 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0D817482DD; Mon, 4 Mar 2024 15:50:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="TRimCEW3" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 31E1D45BFD; Mon, 4 Mar 2024 15:50:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709567427; cv=none; b=jDhq2EAw0+pr/0vMORD731Rl4nIX7lYdi/595y6bcc8RgjmPwWSjKyDCO56LDLBtLyLFABDucx+7BopBLyHqOgjmIlAwdQoRXhM4GgelaUc6ZuoRGDXLP9GiOx2K3A29jnzxRQk3nWzN2J/OjV3c2OBt22qVevjn1QV/f4Vuvqc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709567427; c=relaxed/simple; bh=wlqZ5WQ/dxPPrl/h6+AO78c+TduyB6DGNUpNUGSxus4=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=Xx+i2t356N6WLGSdc8WvL1RS9zBvLqwDZNWsQj1K6Q5DEvVSLV2faN3XKTg9Ia/HvuSCjweMJlVMa7WmWhHPXHgby37KCBe5rrkoNbvxcSk2Yot97goqDqFwf0oiLgJeH/pfG0Gfa2S0VvZFXZWMVbTTxPNV3CO7ZCxNFUJn+M4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=TRimCEW3; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 298F4C43399; Mon, 4 Mar 2024 15:50:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1709567426; bh=wlqZ5WQ/dxPPrl/h6+AO78c+TduyB6DGNUpNUGSxus4=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=TRimCEW3/+jtrrcSRbPpUgzRs23Q/HCsO9K743eBCPPMqCY16lgirDsgWlLchG2Ja U0mTVIdEGAhgT0RuiuXuLMNVrYEXfNdOz2i7nNWdMHfMjCD1nHAydEPgnYmDa8fp0m p5nn20vVXKDousRjRGoWMuq9ef/3xOsWtp1MKQM+DId3wpCZlFWfUM27DUq/UZa+KZ Q5TQtpmo0paqGfwb0ToljnuKIMtxVUOcUiZYPc12pwn4h+/S+soN24u0O+U9k8/3Zr D8d3XNi01fWK9PaUnBFj2FyfNbGOp7pBxpW4rzf9e4+AOWGSlw17GQSQlqeJfr6Su4 dDSfzX9QsJuHA== Date: Mon, 4 Mar 2024 15:50:21 +0000 From: Simon Horman To: Horatiu Vultur Cc: davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, lars.povlsen@microchip.com, Steen.Hegelund@microchip.com, daniel.machon@microchip.com, UNGLinuxDriver@microchip.com, bjarni.jonasson@microchip.com, netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH net] net: sparx5: Fix use after free inside sparx5_del_mact_entry Message-ID: <20240304155021.GH403078@kernel.org> References: <20240301080608.3053468-1-horatiu.vultur@microchip.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240301080608.3053468-1-horatiu.vultur@microchip.com> On Fri, Mar 01, 2024 at 09:06:08AM +0100, Horatiu Vultur wrote: > Based on the static analyzis of the code it looks like when an entry > from the MAC table was removed, the entry was still used after being > freed. More precise the vid of the mac_entry was used after calling > devm_kfree on the mac_entry. > The fix consists in first using the vid of the mac_entry to delete the > entry from the HW and after that to free it. > > Fixes: b37a1bae742f ("net: sparx5: add mactable support") > Signed-off-by: Horatiu Vultur Reviewed-by: Simon Horman