From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=52.101.201.3 ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1796161204; b=Y0JuBXV5mqKuXek1vteahS5u6tktpFbNsgNZl8VerzwVH3cCv48q8NmABZsEM6zT01z3 O4SJUZnvsVNH6vVa1IZTGIhLG7EPpCvMGY8LbzLygt7jcy98RLfz2UTHKppvK3HYfp+zn 0PGnzSzO/JUicp7JUcBmbefOc3BbWrx9ZM0W9W4ZkTQNaxUBgIKqd2ijoF2EwgHkNNsGF K/jEtrmX+jobLarSbnpR427EyuoUtwEEh+x7ZeqjuGg8P86iBZ7vGmqlh9bHWPt+V4c1B TBR4/sG/zOYy26WGV7bttfK1T/MIf3IG0MxNWA0IG7IjIsEVsCrl90IS+uEQZUjc8UQ== ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796161204; h=DMARC-Filter:DKIM-Signature:Received:Received:Message-ID:Date: User-Agent:Subject:To:Cc:References:Content-Language:From:In-Reply-To: Content-Type:Content-Transfer-Encoding:X-ClientProxiedBy:MIME-Version: X-MS-PublicTrafficType:X-MS-TrafficTypeDiagnostic: X-MS-Office365-Filtering-Correlation-Id:X-MS-Exchange-SenderADCheck: X-MS-Exchange-AntiSpam-Relay:X-Microsoft-Antispam: X-Microsoft-Antispam-Message-Info:X-Forefront-Antispam-Report: X-MS-Exchange-AntiSpam-MessageData-ChunkCount: X-MS-Exchange-AntiSpam-MessageData-0:X-OriginatorOrg: X-MS-Exchange-CrossTenant-Network-Message-Id: X-MS-Exchange-CrossTenant-AuthSource:X-MS-Exchange-CrossTenant-AuthAs: X-MS-Exchange-CrossTenant-OriginalArrivalTime: X-MS-Exchange-CrossTenant-FromEntityHeader: X-MS-Exchange-CrossTenant-Id:X-MS-Exchange-CrossTenant-MailboxType: X-MS-Exchange-CrossTenant-UserPrincipalName: X-MS-Exchange-Transport-CrossTenantHeadersStamped; bh=jro7T8NQJ5LI3Pct19ODk50VzruNu2BmcN3FCbNd9DY=; b=MDDAwGBvOV89Zd34XhQXfCaY12lsK1s0yxK9H/gumsVZcfMG0fLaEgxFjJ8chwNF9gqs BPJbHvFr/Zi8r06EceGQDItIbznFyDakK2yelH9BaBN/aAdTrxRFouRIP6q/MBK5p8Cs5 Nne/MZ7UAu+nbxGANjl0WdLdT+DpSocm2b5HHSxvyg4AtYO94ZbNu7Tacqi83nNgwuM/y F8ZBRQYw3S9+8BaSEfZDglnrD1+rlQDSFsYjfQzNIzXT7ZFTSIUmjKiJ+8aE3e/HUsQDD IkQQssUCDLcUshY9PmbdEnAUxOyHyeR0ulQHfK7LFir+CS4yVK6mwxkRPG44xamKFMA== ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass header.from=amd.com; spf=fail smtp.mailfrom=amd.com; dkim=pass header.d=amd.com header.i=@amd.com header.a=rsa-sha256 header.s=selector1 header.b=T0xdZn9e; arc=pass header.oldest-pass=0 smtp.remote-ip=52.101.201.3 Received: from PH7PR06CU001.outbound.protection.outlook.com (mail-westus3azon11010003.outbound.protection.outlook.com [52.101.201.3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (secp384r1) server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 961DB606A31A for ; Tue, 1 Dec 2026 21:40:03 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 961DB606A31A Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key, unprotected) header.d=amd.com header.i=@amd.com header.a=rsa-sha256 header.s=selector1 header.b=T0xdZn9e ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Xi5Hn8EOGhuInlDba1VzzZYU3L0djd1wndzn18nLPi39HsgBDYw9qpVaXxFXV9NLSg1caHauy5JrtqRUQ4sD3eXTcKRx4oz0aCEcQGnhNIagsWCxMiCT9IVbNRxmzqROaAuUxVNG9DMWCwguSQyzevfrLLj0bnKsLx8Q6sTjFJvPQ9p6Znj1RZoobsMqEZEV49t2PX7ltQZrwBpnd2fSmILH5D2C9Nj0KFbF+PgNObBc/QdFnLFM11LJCdYRbYWy2M62pJOVYQnRNyAgwZaqfa9iuxDHv4pui0dkBxdGGiX8dC7NBs+kFXUBa9vaPw73RI7Z6j2j8L3chbcna6/A5g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=jro7T8NQJ5LI3Pct19ODk50VzruNu2BmcN3FCbNd9DY=; b=LOgICcySOAkJgZkLGp0pMpMQKUe+UBDn4zNNz4qyudgmOnEGHryEMC7Bv4WcByMUxHpVSKSG7+wxGP7881/Gfxb0KMWdfFtpVp3T9ShLv/4qxXGdhDgbwGvyuSeRi1HxkdSmLb8DrqvB26lCu08c7qpUwvLpyD9vBPS7mriDpz7G7MIMSQKOS2r8ED9rtJouNchsorVVHHDai6AVW7e+WRw4rHSGVCPNjCqTSKnHIjU9SV1x9A3WuMgWjfDhxuqyWbFb5heumSgywxFHeqWtVK5xaWx/Cgurr3rpfY0JHnjpVaN8gGRa/PCSV6JZowt46tCt3VLmPnyghMEHYgtgpw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=jro7T8NQJ5LI3Pct19ODk50VzruNu2BmcN3FCbNd9DY=; b=T0xdZn9eIIM8iKDXoBM0rg4algHNAX1IlR+3e47XxzyG2PxA66p42DgUk9tA5qaAfru3aUHBZyaDKLfOrsPy8gBRXXOZAWrNKgseA58bbGhNJaXxjDRtsQ6Ht53vHbOfVAUOpulaG9jjUTPIixAEuf0IByZfJJp0ViIW+icPap0= Authentication-Results: mx.microsoft.com 1; dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=amd.com; Received: from LY0PR12MB782425.namprd12.prod.outlook.com (2603:10b6:404:22d::6) by DM4PR12MB7573.namprd12.prod.outlook.com (2603:10b6:8:10f::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.688.10; Tue, 1 Dec 2026 21:39:57 +0000 Received: from LY0PR12MB782425.namprd12.prod.outlook.com ([fe80::ec45:f423:fe60:54ab]) by LY0PR12MB782425.namprd12.prod.outlook.com ([fe80::ec45:f423:fe60:54ab%6]) with mapi id 15.21.0688.009; Tue, 1 Dec 2026 21:39:56 +0000 Message-ID: <7addb297-9e8b-4693-891f-4128814d6f63@amd.com> Date: Tue, 1 Dec 2026 16:39:48 -0500 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v12 5/9] drm/amd/display: Take over the current stream and dc_state To: Maxime Ripard , Maarten Lankhorst , Thomas Zimmermann , David Airlie , Simona Vetter , Louis Chauvet , Haneen Mohammed , Melissa Wen Cc: Daniel Stone , Jocelyn Falempe , =?UTF-8?Q?Jonas_=C3=85dahl?= , =?UTF-8?Q?Michel_D=C3=A4nzer?= , Pekka Paalanen , Sebastian Wick , Simon Ser , Victoria Brekenfeld , Xaver Hugl , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Leo Li , Rodrigo Siqueira , Alex Deucher , =?UTF-8?Q?Christian_K=C3=B6nig?= , amd-gfx@lists.freedesktop.org References: <20261120-drm-reset-state-flag-v12-0-42d63d7417fc@kernel.org> <20261120-drm-reset-state-flag-v12-5-42d63d7417fc@kernel.org> Content-Language: en-US From: Harry Wentland In-Reply-To: <20261120-drm-reset-state-flag-v12-5-42d63d7417fc@kernel.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-ClientProxiedBy: YT4PR01CA0289.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:b01:10e::29) To LY0PR12MB782425.namprd12.prod.outlook.com (2603:10b6:404:22d::6) X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: LY0PR12MB782425:EE_|DM4PR12MB7573:EE_ X-MS-Office365-Filtering-Correlation-Id: 51489723-e488-4591-b4df-08df4ff3a426 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|366016|376014|7416014|23010399003|4143699003|22082099003|18002099003|56012099006|10067099003|11063799006|261026140227099003|261022075727099003|261028144727099003|261022105027099003|261026121527099003|261021121427099003|261102123227099003|261021123027099003|261009223027099003; X-Microsoft-Antispam-Message-Info: O2BoHH4BoroS85M++ZhzG5tfCummzFidfyYrV/S3NeL/9fwNLnfxZz3ZGZXWAluUCdkMdh5Ern+0xhu9sWGc/w23rbLlIuioHIRbuZnRtYYDj+Vw3+n9ZvhZkCLvLuTWMiC8uAb63AXn7MEXKg5dMEaO2OPo9vLqzUr/Vw2Vqih09DI3MrBJiu3m89ZWgPVizFPZRPPHFReKOXFageI3cz4hkSPc6bSsUgww/gHVw/EyXcF51GP1te3lv+J3sePqRIEhXsuAYBuLgrORYFDku7XURhg8QBspEQ2qZLcXjbDiDQCTqmwNJLx6YahGOATg6W2PIVzGsTqw966LxrnnU/bIKpkqUCb0ZQHTzpPNqLq0w8CSj23qka2hhjD6neUhwQzA1RZuEh00awMRA7kr8Tg5AgKny3i6ZkO0nLaNQ4kf6Cf/soN6eglxIuyC5hP+20uRTDUUohgrcORsUZMEKfewIQTPEGmbAo2B6Gafi3wRUJHP+WxDlhsNXmkVWgdbWaAFyqML+TByR15H6tIdmH6mortGkHbgP0k5uI6mjTB28UBamago7jMzDwIbegnLgVBOkAWConLTUsiPZKdAquSc0QLB/Co+guJqZ5dZ95xnXqNjp5E3qS0XDiHr+MSiKuWsfkOd4u/Wn9ZsBQa6BZSGupNYfwlPNIhzQwnZ4Jw= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:LY0PR12MB782425.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(1800799024)(366016)(376014)(7416014)(23010399003)(4143699003)(22082099003)(18002099003)(56012099006)(10067099003)(11063799006)(261026140227099003)(261022075727099003)(261028144727099003)(261022105027099003)(261026121527099003)(261021121427099003)(261102123227099003)(261021123027099003)(261009223027099003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?WXN3L215QWo3QVZDcmN5a2hkazZNRExEMnFYREJwamNmRlZNd3R4bVdCNEV1?= =?utf-8?B?S1lKbkZkM2dneEt0RzBNbkpYamM3UEEvZElzS2k4dzc3QmloeXV3T1ZZWUUy?= =?utf-8?B?MUdqVmdKQkh5dENZVWhyWlpaNGZqdkFPWkZkTVU5a2lyVS9abjZBWXM0b3dL?= =?utf-8?B?SVBiRklPbG81T2RWNFFmcmdWWFF2UW1UZjJOaklRdTRNek9QRXUrdHFSSXov?= =?utf-8?B?WS9XVVo1MU5TbDQxQXdvbTlRK2lHM21XSDJSMnU2OStQN2NvaDJxNlNQbHNv?= =?utf-8?B?Q1ZheE5TbjVDSStsU0hvYm4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FkTzYwZFQ5RlpP?= =?utf-8?B?Tkg2MXhab0t5N3p6ZmFzeVIxZkhET3pWQ3hVY1pxMGh2YTlXWitFK3FXVDdF?= =?utf-8?B?djNQdWZ1dXU2U0cvZUdGL1BLRG1vcUhxU3dyNklsS21EMTlEa05Na3hvZThx?= =?utf-8?B?UVBQa0hXSE53emxZUEpmcHBTT2ZJSzhrRE54ZUl0Ny9sMUpJWE5ydlBRcmsy?= =?utf-8?B?TEpVNFc0ZU5IdDFSdnd3OGRrNW5FZGhkckJ1c21IdTlaWGVKU2tUZz09?= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 51489723-e488-4591-b4df-08df4ff3a426 X-MS-Exchange-CrossTenant-AuthSource: LY0PR12MB782425.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Dec 2026 21:39:56.0595 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: Xi6wRJln5x1EPeJ70a4ONfw9vJSOtZ9caFGnyyEHzsHsfKTh3RGYBL28glBnE1gAajxl1zfaB0+VeLZRQsgWyQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB7573 On 2026-11-20 08:10, Maxime Ripard wrote: > drm_atomic_commit_fill_with_defaults() builds its commits out of > states created through atomic_create_state() instead of duplicating > the current state. A created state comes with no stream nor dc_state, > while a duplicated state carries the ones in use, with their > reference. > > The update passes of amdgpu_dm_atomic_check() release the stream and > dc_state in use and clear the pointer of the new state, on top of the > reference the current state drops when it gets destroyed. Those > releases are only balanced if the new state brought a reference of > its own, so a commit that disables or reconfigures a live CRTC or > plane through a created state over-releases and frees the stream > early, leading to a use-after-free when the current state gets > destroyed. The paths that keep a CRTC or a plane enabled without a > modeset also work on the stream and dc_state through the new state, > and hit BUG_ON(dm_new_crtc_state->stream == NULL) since it never had > one. > > Take the stream and dc_state of the current state over, with a > reference, at the beginning of amdgpu_dm_atomic_check(), like a > duplicated state would have carried them. This has to happen before > the update passes clear the stream of the new states: past that > point, a state whose stream was cleared can't be told apart from a > created one. > > Signed-off-by: Maxime Ripard Reviewed-by: Harry Wentland Harry > --- > > To: Harry Wentland > To: Leo Li > To: Rodrigo Siqueira > To: Alex Deucher > To: Christian König > Cc: amd-gfx@lists.freedesktop.org > --- > drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 50 +++++++++++++++++++++++ > 1 file changed, 50 insertions(+) > > diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c > index 0ea45ab12119..b2eddb87dd5c 100644 > --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c > +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c > @@ -6279,10 +6279,60 @@ STATIC_IFN_KUNIT int amdgpu_dm_atomic_check(struct drm_device *dev, > struct drm_dp_mst_topology_state *mst_state; > struct dsc_mst_fairness_vars vars[MAX_PIPES] = {0}; > > trace_amdgpu_dm_atomic_check_begin(state); > > + /* > + * A CRTC or a plane that stays enabled keeps its stream and > + * dc_state: a duplicated state carries them over, with their > + * reference, but a state created through atomic_create_state() > + * comes with neither. Take them over from the current state, > + * with a reference, like a duplicated state would. > + * > + * The reference is needed when the update passes below > + * reconfigure the CRTC or plane: they release the stream and > + * dc_state in use and clear the pointer of the new state then, > + * on top of the reference the current state drops when it gets > + * destroyed, so that release is only balanced if the new state > + * brought a reference of its own. The pointer is needed when > + * they don't: the paths that keep a CRTC or a plane enabled > + * without a modeset work on the stream and dc_state through > + * the new state. > + * > + * A stream or a dc_state in the current state means the CRTC > + * or the plane is enabled, since they are cleared when it gets > + * disabled, so the conditions below already single out the > + * live objects. They deliberately don't check whether this > + * commit keeps them enabled on top of that: the update passes > + * release the stream and dc_state of the CRTC or plane being > + * disabled too, so their new state has to bring the reference > + * just the same. > + * > + * This has to run before the update passes below clear the > + * stream of the new states: past that point, a state whose > + * stream was cleared can't be told apart from a created one. > + */ > + for_each_oldnew_crtc_in_state(state, crtc, old_crtc_state, new_crtc_state, i) { > + dm_old_crtc_state = to_dm_crtc_state(old_crtc_state); > + dm_new_crtc_state = to_dm_crtc_state(new_crtc_state); > + > + if (!dm_new_crtc_state->stream && dm_old_crtc_state->stream) { > + dm_new_crtc_state->stream = dm_old_crtc_state->stream; > + dc_stream_retain(dm_new_crtc_state->stream); > + } > + } > + > + for_each_oldnew_plane_in_state(state, plane, old_plane_state, new_plane_state, i) { > + struct dm_plane_state *dm_old_plane_state = to_dm_plane_state(old_plane_state); > + struct dm_plane_state *dm_new_plane_state = to_dm_plane_state(new_plane_state); > + > + if (!dm_new_plane_state->dc_state && dm_old_plane_state->dc_state) { > + dm_new_plane_state->dc_state = dm_old_plane_state->dc_state; > + dc_plane_state_retain(dm_new_plane_state->dc_state); > + } > + } > + > ret = drm_atomic_helper_check_modeset(dev, state); > if (ret) { > drm_dbg_atomic(dev, "drm_atomic_helper_check_modeset() failed: %pe\n", ERR_PTR(ret)); > goto fail; > } >