From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (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 6601D307492 for ; Thu, 20 Aug 2026 18:28:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787250483; cv=none; b=oKw1B7RYhqqBylSszhGBSJLFhs5fHrjFHPVAxbPISEeTIdip4pczQ/qsKaoV9ryG+z5cHumbGsYqImOmkxhMKzpMBLeoNaqjo1veVl8OMJ4wM8J6ZolmlXYGORrX0BgCDtgWI+gjBq+F+Zh5ODPQMP8i3We57Z0WkQMHCJCfSA0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787250483; c=relaxed/simple; bh=xw8PnvQ0OnWjbD+iCJNfjRA8yo5BsX+mtGCSOrUGMEQ=; h=Message-ID:Subject:From:To:Cc:Date:In-Reply-To:References: Content-Type:MIME-Version; b=aKaftDoEJaNuA+frY0kRWurCXM1PQEJ5hFjWpjCx/4ERsQCh6OyvAGvCnPvOH02lyqymmyWzeABHi8n2hh4AZ8j7yvgVXSJAuhNb6VpArEab6ZqL5dtgNI5HvI4cy45ChT9uisO2T0qUKtsNANpV8dRdz7FlTpVrmtNDKyYGa78= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=cIbwClXx; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b=i9qfDZY/; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="cIbwClXx"; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b="i9qfDZY/" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1787250481; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Rl/GCSC9mrxRzZFL9EE5o5Bx5mzQPkItraIxAO9n+xk=; b=cIbwClXxunJRDQBo+hst9z7sGD4l0CXC0GtbvscgX5/rpi4E65T+2o9lWmo3/uQ9PxrK2S hZt1Dya2w+o2rqp0MwHuJtkMRdSDgq8r4qisw3nov0jLUV17htUtIfTSuxpc4EJN7i6owl 4npx8M4yBQ7thzIRTs9RR8jyeYW10Us= Received: from mail-qk1-f197.google.com (mail-qk1-f197.google.com [209.85.222.197]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-49-fmXeX9KuMZmQq0KhKD4jwA-1; Thu, 20 Aug 2026 14:28:00 -0400 X-MC-Unique: fmXeX9KuMZmQq0KhKD4jwA-1 X-Mimecast-MFC-AGG-ID: fmXeX9KuMZmQq0KhKD4jwA_1787250480 Received: by mail-qk1-f197.google.com with SMTP id af79cd13be357-92e63df032bso143360585a.0 for ; Thu, 20 Aug 2026 11:28:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1787250479; x=1787855279; darn=vger.kernel.org; h=mime-version:user-agent:content-transfer-encoding:content-type :references:in-reply-to:date:cc:to:from:subject:message-id:from:to :cc:subject:date:message-id:reply-to:content-type; bh=Rl/GCSC9mrxRzZFL9EE5o5Bx5mzQPkItraIxAO9n+xk=; b=i9qfDZY/Ry0c1/e/uQuoBlWOyM0WJQZvZdaVo3rRtKgL5d8+vWxDI8iZOl6Tn6Ol8W Kz5+EblVaqhnxLxjx+FLzDFpWzFamTmC3Sl5vtb0INZjZ2I+D0M3nSPVP2pf1/lrx/Yw UvDEy0VLdsP0nMg5GS3VWsF9mK2ByeJnbaRP2kc3JVzENWN65o0hr8glXk2CIKirQcZV 8+TQRqYpflAWWYvIbEvSKW7nkmlxjLLgFpGbln0rNhMUswZCodg8YhxhkqWR7iguRonT HDd9B1kiH2aT3BuQPHNG8WUf67ddXY/j594v9CoQJZ47/nt7QDcyJ6vm87Dhpah6BVs7 tkMQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1787250479; x=1787855279; h=mime-version:user-agent:content-transfer-encoding:content-type :references:in-reply-to:date:cc:to:from:subject:message-id:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=Rl/GCSC9mrxRzZFL9EE5o5Bx5mzQPkItraIxAO9n+xk=; b=Jxd1UA5tV8BTmUK10nCGZfD2SYaeCDykN/q2lRTjM66tLqAum9u9stNfR9TOlevBiT KVwAF6PRd8S4DvtuKXMFG4vLYbcGF23NcqH/V60Ek3WrZ207Ts5zmwMKllqpifPAfm9V 22j9ZpKHWdEKepvQZ5fvglpWuUfYCTy9ZoU16ek4E8jtaPCz1a5pk1XdORZQ/27Y2vj6 Dq2UblWUvk+Qzn4Gtok6fNaIhDDaSOCTinBm+BpcZscHZp7Bo4P3tc2ztUnosZS9dER6 csvdL+WxKqPflIQg4pdplassSTLJ4Blu8p9h1hQz126f6l2T5DxjgqUsTFThhgshUMQA 65xQ== X-Gm-Message-State: AOJu0YwlM5DPnpbZlnLHIb3qnDYfQ1txlef0iILEJfbPGudvm0Q+gPwe G6NmlDXssIdyVPgGg83wBcCp5HN6LQOcaPx4mBfE35RY2kjgqL+o3IIYLTSmqn6vZSEu27q6KVh qk/t4UZqyFaxYuCbnvJ7P4gC+aRcsE31jmDcEchd0iNHGsvdYAcRndQLhR+I0RCLegQ== X-Gm-Gg: AR+sD13mcDoYhu+j1g7j2wjOruR0ah6j54DJr3VlXUY45/VdhXfPK8pNV7cCUxYbYLx 5Wfl/w4FWtSZXzOQjo2Yqkcy60xYrpWHiRXbrBK2uyfzmu7qhpS4X+FLQrIVZvIlLZ3rFVF79S7 huFFj13+iYsM/Kmq7C4Mrh/ZuGkpMHtvjf5BmixOViJszdc5vox6TBEZh8q4pJRm4qPqeWf14z3 wwf7Jdh1abppTOVf+dJb6QV9OZc1xyk9cIY73+ujedz8QHR8FzYFaiddf+Xr7jheruwWvd5cpY0 QjiIr5j++F/SddRZCt8/6TVnCFT7r8mEKag+tZYzt0720no3QFdzEfwhl4fwNkDSobrmMKHi X-Received: by 2002:a05:620a:28d4:b0:929:f78f:6bf9 with SMTP id af79cd13be357-93728497619mr773547385a.16.1787250479110; Thu, 20 Aug 2026 11:27:59 -0700 (PDT) X-Received: by 2002:a05:620a:28d4:b0:929:f78f:6bf9 with SMTP id af79cd13be357-93728497619mr773478485a.16.1787250468774; Thu, 20 Aug 2026 11:27:48 -0700 (PDT) Received: from [192.168.8.4] ([100.0.180.93]) by smtp.gmail.com with ESMTPSA id af79cd13be357-9372056b78esm422216885a.30.2026.08.20.11.27.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Aug 2026 11:27:48 -0700 (PDT) Message-ID: <5a22c376eb0ded8e1cefcc042176f8c77f68658b.camel@redhat.com> Subject: Re: [PATCH 2/3] drm/nouveau: cancel the DP IRQ work before freeing the connector From: lyude@redhat.com To: Marek Czernohous , nouveau@lists.freedesktop.org, dri-devel@lists.freedesktop.org Cc: linux-kernel@vger.kernel.org, Danilo Krummrich , David Airlie , Simona Vetter Date: Thu, 20 Aug 2026 14:27:47 -0400 In-Reply-To: <178682366002.3748010.4096452389040554615@gmail.com> References: <178682366001.3748010.7798811159846779765@gmail.com> <178682366002.3748010.4096452389040554615@gmail.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.58.3 (3.58.3-1.fc43) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Reviewed-by: Lyude Paul On Sat, 2026-08-15 at 21:54 +0200, Marek Czernohous wrote: > From: Marek Czernohous >=20 > nouveau_connector_destroy() tears the two nvif events down and then > frees the connector, but never cancels the work the IRQ event queues: >=20 > nvif_event_dtor(&nv_connector->irq); > nvif_event_dtor(&nv_connector->hpd); > kfree(nv_connector->edid); > ... > kfree(connector); >=20 > nouveau_connector_irq() queues that work unconditionally: >=20 > schedule_work(&nv_connector->irq_work); > return NVIF_EVENT_KEEP; >=20 > A DP IRQ arriving just before nvif_event_dtor() therefore leaves > nv_connector->irq_work on the system queue past the kfree(). When it > runs, nouveau_dp_irq() derives both nv_connector and connector from > the > work_struct and dereferences them, and goes on to take > outp->dp.hpd_irq_lock. >=20 > There is no cancel_work_sync() for irq_work anywhere in the driver, > so > nothing else covers this. Add it after the event teardown, where no > further work can be queued, and before anything is freed. >=20 > Reported by the Sashiko review bot as a pre-existing issue, in its > review > of an earlier nv04 FIFO series of mine, and confirmed against the > source. >=20 > Reported-by: sashiko-bot > Link: > https://sashiko.dev/#/patchset/20260812231330.705425-1-mczernohous@gmail.= com?part=3D1 > Fixes: 773eb04d14a1 ("drm/nouveau/disp: expose conn event class") > Cc: stable@vger.kernel.org > Assisted-by: Claude:claude-opus-5 > Signed-off-by: Marek Czernohous > --- > =C2=A0drivers/gpu/drm/nouveau/nouveau_connector.c | 1 + > =C2=A01 file changed, 1 insertion(+) >=20 > diff --git a/drivers/gpu/drm/nouveau/nouveau_connector.c > b/drivers/gpu/drm/nouveau/nouveau_connector.c > index b0b0ad9a0c24..e49dcaa6d210 100644 > --- a/drivers/gpu/drm/nouveau/nouveau_connector.c > +++ b/drivers/gpu/drm/nouveau/nouveau_connector.c > @@ -397,6 +397,7 @@ nouveau_connector_destroy(struct drm_connector > *connector) > =C2=A0 struct nouveau_connector *nv_connector =3D > nouveau_connector(connector); > =C2=A0 nvif_event_dtor(&nv_connector->irq); > =C2=A0 nvif_event_dtor(&nv_connector->hpd); > + cancel_work_sync(&nv_connector->irq_work); > =C2=A0 kfree(nv_connector->edid); > =C2=A0 drm_connector_unregister(connector); > =C2=A0 drm_connector_cleanup(connector);