From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796546669; b=4iPfYkN7YG0uBI9w9dkTLSQURJAFR+k2rdBVoHvslG0NVJcBpHvUZtShV3UamsodiIDb gWDd+YqBxRW9U5QdwIYTsdRpCY4fL4o9FhGk+aXLcJ9lguHHqHSF0mzLOPCejeoJ/Tcra gfFmZNQ0C6/tXNQp4IP7y6cBUxUWpzYxvOLMTB9X6UOFUwyTCyyUgjhx45jOc5gMJ5mSp 7/X5Ynl3quktlx3raeJ8O9/fs2OIbDWSeI+eZAyQAladem2V+Ut8+SYPDBJGZys6HxqCB nbQVtajSPZ9uD4wwiZtonYfX8C887Bm3RoToy1J3HOzIPb3ngCfNeEJ0hjkt/vHJSxA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796546669; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To:Cc: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=hEkzzdfG5tdyc+MiOowWtkPXvVMmV2gDKPSNb8/zGdg=; b=jxVKhUhHCPOggvGx+xgubptS90v0/KoQzHECPaV1Cs7E6ZYEz2oL8aMXJziL38t+rzzo ysxs5Ig+6ZmGj0MzICcCDpN6+jQFcUTHLHnAAVcgP6SBRLYTL47N/gDHlahyrDsc6Hb82 ZKLyb4O7rj4cMw31KN4T3g/a+CmDeaonIlZQdX80X6hj4hwF1s+UxXvN+A8HXeuR0VjZD XA/WrDw5qdVUWDI/WkV+sMsUIDc7wcnID8ON0Y1ChbrnVv8przTY8IKfxiisUoRoOthSB jPPgA8VrtytC62AIslnhF5bEZNcTlNwyz0fDEOsNRJrDqPkM9R08FXZ/WYuLPW/TAfA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b="hNHtHo//"; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 649CF606A31F for ; Sun, 6 Dec 2026 08:44:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=hNHtHo// Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1BBB41F00A07; Sun, 6 Dec 2026 08:44:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796546669; bh=hEkzzdfG5tdyc+MiOowWtkPXvVMmV2gDKPSNb8/zGdg=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=hNHtHo//WFQGqIjVYtGXxMS5ymlxEk+PFdg/J2GUUuVmaQEvUV0K5xrKrXZ5XfdFO TwDwRDoVMyNkeDnD8aziEdzE9OviJwm7iGN0fBMoArBVd/j3Ot6xj0SmMgnYYI03yj GFULD2Khrb1PUL/Y1H/v4AMp1eh7ldYvq4lpoSWPo8a13wmxRA+NDv8Z38tUb/jnOw Cl0JZexKCJchrLof8WqMu0bCRT+k11saekIJMrnNj642xY51969w4uruO5IExvhhD6 ARDoWFsrZp/8ctZqxnow/8eeMWXyfZ/kknsHjo8r0vw+S1LXP2ALWfPTLj1qDxT+mK EOEgS5TxlOwIA== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH] PCI: endpoint: check epf->epc and epf->sec_epc under locks in pci_epc_add_epf() Reply-To: sashiko-reviews@lists.linux.dev To: "Ziheng Wei" Cc: linux-pci@vger.kernel.org In-Reply-To: <20261206082942.1296-1-zihengw03@163.com> References: <20261206082942.1296-1-zihengw03@163.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Sun, 06 Dec 2026 08:44:28 +0000 X-Mailing-List: linux-pci@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list > pci_epc_add_epf() checks epf->epc and epf->sec_epc before acquiring > epc->list_lock or epf->lock. Concurrent calls binding the same EPF via > configfs can both pass the unlocked check, allocate two function numbers, > and call list_add_tail() twice on the same list_head, corrupting > epc->pci_epf. >=20 > Acquire epc->list_lock followed by epf->lock (matching the lock order in > pci_epc_linkup() and the other EPC notification helpers) before checking > and updating epf->epc and epf->sec_epc, and hold epf->lock symmetrically > in pci_epc_remove_epf(). >=20 > Found by LLM-assisted static analysis. Compile-tested on x86_64. >=20 > Fixes: 5e8cb4033807 ("PCI: endpoint: Add EP core layer to enable EP contr= oller and EP functions") > Cc: stable@vger.kernel.org > Signed-off-by: Ziheng Wei Sashiko has reviewed this patch and found no issues. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261206082942.1296= -1-zihengw03@163.com?part=3D1