From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-vk1-f171.google.com (mail-vk1-f171.google.com [209.85.221.171]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 37D9F2749E6 for ; Sat, 10 Oct 2026 00:35:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.171 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1791592519; cv=none; b=agbyr/dTcuptR42Z4/voluEnG0yb2lH/WQV7POX7n4k/wFgvZDN5eJzbC6Pb+Cqa0bF1OiM4yAMuUX3GsX86bys/Y8poNquffGWgcGPR5okI1JVRrVur1vMGfL2DmAD/3w7wKzOC/pyUXClz8cfssyg/KhVfkMOtDb8Q1At5AbA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1791592519; c=relaxed/simple; bh=IgFB88Fae52t0faG3mtsC7gchDUT3CA1h7QB8FY2kik=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=rc9y2zEQd067zWFtzURyiaw0wrS8yYdeysnyazne7GYmBgc4VUANaM69EzKtTTWZ8jSHpWgFhZsanLgEEgaFa9NFfuLZ7a/3GFrSmWhmSuWY8Xp9HWE5s/0ETJQ2+Pl8437Oo4KDakOi+N/xfZasFKL3+chroX3ocRNXj12voJ4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=OMpuP2lu; arc=none smtp.client-ip=209.85.221.171 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="OMpuP2lu" Received: by mail-vk1-f171.google.com with SMTP id 71dfb90a1353d-5e67a6b3633so98238e0c.0 for ; Fri, 09 Oct 2026 17:35:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1791592517; x=1792197317; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=IgFB88Fae52t0faG3mtsC7gchDUT3CA1h7QB8FY2kik=; b=OMpuP2luIWUXSOokqFYKskD1vtICaWgfVYyARPfzweGhptCVlmNybvwaI1CIUZam4A ruMit2hLONXcXt2k71vBVv9hXEaqtu/e/D41uWkp0UCse4BjPXgcBiRTBBRW7hp/24n7 6AX2rMsrF2y6oQwLctFLsgicW/OWpeYfAvY48u0d1Jb4flgwOUaTFTnd5ybAQ6VB11el GpGq1trMQUoy4DgrS5/rTJMvfHkYfqWeog6wDJVYb+Q6FFmeNri4ukAjaHpRftMFLEu/ ofylP4Kx9iKqsc8tQ4KJcgK7Xi6qyDCLdRZH9aDKFSr5Aj/Ow2GP9mOvrQl5+dvg+uJm MgNw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1791592517; x=1792197317; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=IgFB88Fae52t0faG3mtsC7gchDUT3CA1h7QB8FY2kik=; b=2jZK0dyJCqXKKJHlKyAs2IVIBvW0lgFs/dI1V+WcAd8/fBBFEw3E91lppxkSeQnl9q RLoO65xn4z4komGuu2Q5YLnLBqzuPeJp1i17jC8J7DB+txzQa6bMJriUmNaeBBRFRHrN tF05PnHOQgOIabtiqtuqei5wjdyjmn2zXQjOpinAzYviqry0qewXpTM8rE6C4jkFTra3 D026HUOf+NqwM8GOurhqjhr+WfxZBQhNWaBluG6wq6GMxnXCTBgGi7amZKwmL4gcZuc0 J0FfO2NrxsxylPAIVxOpN8BcdFYtcKAx3MHpEYutz8j1V3dfBgiRfvpuRArX2HFVXD4e O9rQ== X-Forwarded-Encrypted: i=1; AKwUvBxRXC+8yWPkeqw5d2s+mT/W0+xbSGUqK8FVT2qzQooCU+tl6OlbZMgl2lfuzAJgv5lWoCFC2VJnuURHRFI=@vger.kernel.org X-Gm-Message-State: AFq9FYKa9z/VB4Ki6+ss3eH8HRnK1bDzTgxZWMIVLHkvaztoUsBAywWc RNNBPd1FcTN5GYv3IWZ5PCflHePV4/h27IBVKESHJFYNF4SXBQoC8UAf X-Gm-Gg: AYBFou3cmtoC7tF+kwwOTgjpRrUsJWupWGCgwYXNgyh2cGR2IvD7Yc+6rsJ4twX5wie fPIxu+8K3cuEtk2VDLmz8Ft2IU11rs/9bAJHlSyKvBgxwGLRL6glOqt6n5lf7l955VntQ3OStOb d/9Za88dTyoQXCIwDCfFmPJIqsPw/vIIvI14FkUJ2k1kW+5R5tdRFejHaD6soTVBixcEK2weuDL brDBMnPljxILFpTa2cf4QCGrzd/Li9DEQIlgAkLYl2vLbW6AjOZ8LQZlsCkNF506xltJc3z9wbK 5fOqBTFgnE7uXKSNdJVJpJSTh8+1/EH1kUqkYC2zCuLwbPS8tv04tv0oys2W0ijfDXBuH6t3TEz LjNxgHLmWjyYp9XZ+rwgzIsl8MesvLRcn5tZhLg994m8KjZcEEIYXXq06Dsv0hKSlobZBLS9Uek OvIaFCDvqyiC0T1H+YdeYmsttG6HlMGQmOacnLn8sFlfTV15ueTyCJjiErm/U/UuY= X-Received: by 2002:a05:6102:a4f:b0:7c3:9059:49c2 with SMTP id ada2fe7eead31-7cb373593a5mr948439137.22.1791592516863; Fri, 09 Oct 2026 17:35:16 -0700 (PDT) Received: from beelink.. ([187.13.210.57]) by smtp.gmail.com with ESMTPSA id a1e0cc1a2514c-990138f4fe2sm1209146241.6.2026.10.09.17.35.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Oct 2026 17:35:16 -0700 (PDT) From: Aldo Ariel Panzardo To: Myeonghun Pak Cc: Aldo Ariel Panzardo , Greg Kroah-Hartman , Ijae Kim , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org Subject: Re: [PATCH] usb: gadget: m66592-udc: Free the IRQ before unmapping registers Date: Fri, 9 Oct 2026 21:34:54 -0300 Message-ID: <20261010003508.2730761-1-qwe.aldo@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20261003034908.619696-1-mhun512@gmail.com> References: <20261003034908.619696-1-mhun512@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit On Fri, Oct 02, 2026 at 11:49:08PM -0400, Myeonghun Pak wrote: > m66592_remove() unmaps the controller registers before removing its shared > IRQ handler. Another device on the same IRQ can invoke m66592_irq() in > that interval, and the handler reads and writes registers even when the > controller has no enabled interrupt pending. CONFIG_DEBUG_SHIRQ can also > invoke the handler from free_irq() after the mapping has gone away. Confirmed against mainline: m66592_remove() calls iounmap(m66592->reg) before free_irq(), and m66592_irq() takes m66592->lock and does register I/O (m66592_read()/m66592_write() of INTSTS0, INTENB0, CFIFOSEL, ...) unconditionally. request_irq() uses IRQF_SHARED, so a co-device's interrupt -- or CONFIG_DEBUG_SHIRQ at free_irq() time -- can run the handler against the already-unmapped mapping. Masking the controller's interrupt sources (INTENB0 = 0) under the lock and freeing the IRQ before iounmap() closes the window: after free_irq() returns the handler can no longer run, and every remaining access still happens while the MMIO mapping and private data are valid. Reviewed-by: Aldo Ariel Panzardo