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 E509B38F65D for ; Thu, 20 Aug 2026 18:13:46 +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=1787249628; cv=none; b=oxpIeGpgWqBr4d/0J4a6li5uKLlXrcfik3EM3O6mA7tOROOOHuosJ+bB0T5Ir1X04ZKlNFzxtnUusQzo3lOMes/TnFs4AYEvVolfBqkrIoorWywq5sBNia6sOHoAZ+P1wB+T0SHDd58OJkzesCrYd9gCXC0niohjbUbCLHzB5Cc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787249628; c=relaxed/simple; bh=xw8PnvQ0OnWjbD+iCJNfjRA8yo5BsX+mtGCSOrUGMEQ=; h=Message-ID:Subject:From:To:Cc:Date:In-Reply-To:References: Content-Type:MIME-Version; b=Xxjp9m3nuW8SqGMNbIeo0VhcH9V5R1EcrM5nSg7YGK/YO8XsoaV7I6AVJ2XLUKlzXYrJlVtmonWM8NkyBMh4TLBHh2hsmo1xks4wgLTj0lqckOB4CxgCGTTx686jwwnuFNedLkGV3Jk2WjHJZzVUtEXZviOy/ih2UtQe7sti4w8= 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=RXb10Xx2; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b=NQvsN/lP; 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="RXb10Xx2"; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b="NQvsN/lP" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1787249625; 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=RXb10Xx2uhauYd0mbJBRZ1O1ecpmofbv2+GVUvIwylhgxlsqKfcJXxW0IwlIrSi7MT3OJo dtschYzN4ZGvYGWSDnp6v7U9yKF1po4ywWZrTagk9z9TxhImfOHMZR0kxOjwpQXgK4xjn1 9YyQ+M5Tnc8NOwE3hbK0h4iqz1TkZa8= Received: from mail-qt1-f199.google.com (mail-qt1-f199.google.com [209.85.160.199]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-121-0R6P-UYGM5uRgxv2DObv9A-1; Thu, 20 Aug 2026 14:13:44 -0400 X-MC-Unique: 0R6P-UYGM5uRgxv2DObv9A-1 X-Mimecast-MFC-AGG-ID: 0R6P-UYGM5uRgxv2DObv9A_1787249624 Received: by mail-qt1-f199.google.com with SMTP id d75a77b69052e-51c1b4d961dso574141cf.1 for ; Thu, 20 Aug 2026 11:13:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1787249624; x=1787854424; 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=NQvsN/lPZQ5r/gVYbr9er7eEMdaiyREfTQNgiNT5EUoPguX1PekIg91geHzjITI2vu 9wBKt2yR5JRvr5nx9sDEAtk05FvpPjJcEMmDdkwa2st/5FghMWZSKuxDdKj5NRXZZevq BEBAgXHa7w8Lzumfh+vL4IzhrR9ee+tQ0SRrKwOn4gYk+Pv/URnuxmFw4xUK4FLYimCP /nflqqwXK36ZrBsBoAVQkDoa3xMMpislk7NDUPpV8tn6BZTl3QuBwS5gmbItYbMYuVk+ 3liQHCDpokh4APtimVyaxxs2cNy80p17K2nXzZG9+UPBXI0L06/zRoVWizalNb9l7FIn nLoQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1787249624; x=1787854424; 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=fjy6r7bDp/0vk1LQTuAat8n75bmjbcMWzKAJCwVi2FDlqODxaUoAmMOV6PLuakxQgz LyAnfT/YVl7llZQ3BVZC83sV9DDJkyN80BDlvNTZHAgLM63RCf6m85cY5exf0Um/IUd+ DGza4iKpCZpxg+DZkAel00trJIG6GSv2KvIprfbmOS6aQB5YTHZNQz534mIv/8/kBgQX 4FfES5TorKS2kVBS9THyCN0bsMoO5QV7jnBKTPP0/ho+IarMGaO0JeaNh541i3+fGvxU lLaBNt9ftY2HCe/xZb/atu3I6Wav4gdvx93vV9CxD82iy1qZ8vxnpESG/LdWSkvRh1fN SK+w== X-Gm-Message-State: AOJu0YyKSg2d+Bq9pXmt9LSNGbbn5Xr9y4CYTE00qDhKxeNSnZ6eLndc npU4Lf4eZqUea/Ara4BWIf70JSlSzB8gDig65DbB7yMgZUcec0vwwAn/LWoFd0OEdq6YmxEr7id WZbYwcgodqfpVHsGglAJF8QhT0THPTffuz2TxHWxv2fVF8RbwUgCCTFrxtoCCswW+GQ== X-Gm-Gg: AR+sD1340BLs3dBwr2PbfHErI+8CGmfUebHq277K5JE3CzCU3+zUwxvo0Yy/dwNV+4C Me46H/xdcM5q3P34Hqjy+2mtT1Wz3y6Uh/ekKB9vRTtn6wbJYPPNh6y6eyY3Hhuv/o3DyvwBrgN TRZpaK0vqGhIzKpWVjvoxz6A9+ckCkZ0YpDIiPfwTnCRkZ6H16BFc39XVlF7L4aQVc5M1WEmBGm sKKWLloZrmywTd5Sn3ulwBSkITVAj46SoDZY0oab+usbCQh/aCKYBuIPQKexkGDZmmIZXIeXIGa Aex0m5Y3rmTLG+O9vwN0PdoB1sV+VY0Mt69ty1zVCKN9phqhXZmRLteICsmyoPKjRBPLpg1G X-Received: by 2002:a05:622a:4086:b0:51b:f992:9e18 with SMTP id d75a77b69052e-52de2eff50cmr85002031cf.2.1787249624014; Thu, 20 Aug 2026 11:13:44 -0700 (PDT) X-Received: by 2002:a05:622a:4086:b0:51b:f992:9e18 with SMTP id d75a77b69052e-52de2eff50cmr85000801cf.2.1787249622905; Thu, 20 Aug 2026 11:13:42 -0700 (PDT) Received: from [192.168.8.4] ([100.0.180.93]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-90c5edb44easm45361866d6.6.2026.08.20.11.13.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Aug 2026 11:13:40 -0700 (PDT) Message-ID: <40b59b1a40755347533320b65ff1a4342b8e3c8e.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:13:40 -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);