From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pl1-f181.google.com (mail-pl1-f181.google.com [209.85.214.181]) (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 A2BE73E0094 for ; Wed, 8 Jul 2026 06:46:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.181 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783493163; cv=none; b=p5T8gTcU4Yf4yvJAHQShVNDnUnPMosfpEQZh42wUStnfQeBCvpqML+cHXGwqvCDK0t7f+o37/C9goCPKLMYeeNI8lw5/A/GwKOuvzDqNVccS+k0SLvrkJr0VN+zwiiLZqHmYwhvrD27cst4ABQPmHTI3meeiZemaqasclc6GXWo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783493163; c=relaxed/simple; bh=cqggHoGN0+OcTLvJQjdnCnNSNyfDR+zNyBrEYz/UKgk=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=YswF7nje8Gez7zP18YO5g0PdOqRGGrsDe3sKMP/9a31mZzSd7rfn/uR3MmDrdpZDQOhWfUToTGAkx9mZX6FTCIQsvdiAYuu4YNvcT63xiyXVMis/iAG2TKXvpV3iB1Puc0zvwKvYDkhXdEjWaxS9V4LH8WEdkqiGa3KXun1JBDs= 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=tIAoyrTj; arc=none smtp.client-ip=209.85.214.181 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="tIAoyrTj" Received: by mail-pl1-f181.google.com with SMTP id d9443c01a7336-2cc891373e0so3231625ad.2 for ; Tue, 07 Jul 2026 23:46:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1783493159; x=1784097959; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:from:to:cc:subject:date:message-id:reply-to; bh=WJ6VCqrU1S8vuSoFUrp/Z8LoI+05YfC2UR8mKpg8S2k=; b=tIAoyrTj9IR6/R70wYDNrdO2vAxufnCBYlwkq+ODpEDjh5zV8XFoXKVuxZPs5fMeSZ eb/JE9cparHJAnoE7Qbrem5C9xUbX+0UxKUQN4A8k5h78l+HJsh4SeAhzvoYa50msxDM vpIOarJ3I9tWTZOlwpCFFAnp4k4hq9rHqNdmcwga+h1MOm/oua404gbFJgG48cuE18D6 U1wuzAd4RhEhoK+ftZ5+xoaPw9XB7kacR+beTwhOKNjVLLnoaL/wlxkm1ePwMxkN3/kj ydWmkyYU26QGDGj/SLLdM3Nz7dk6uM2/bl0sLlQnKb+jahuYwgxeC/mOLaI7M947W1tI SUww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1783493159; x=1784097959; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=WJ6VCqrU1S8vuSoFUrp/Z8LoI+05YfC2UR8mKpg8S2k=; b=d+6T5GSTgZ6xXiBLp+ZykUZ5XuxDRmE07cmX1V4kP/3iKjskAny58ecZiQ+o0pVf8h pQRuCqvUOyqGfAVq7vdEKJ1ECWKGjvSsDSqhHiqLgiDG1icix1/oQvxFf/fxxvE6ckXY FX1DUk+MADGHii0j0U24APeCTw6cvMyJLtxzRJ/FQdlgbo1Fvp9ksWTll4wFN6UXbLbN i0RK3OcjbBfgneeMQaQnQLzxpiZXd8VD0GPubiNm4W7lLP6jDz/NFH9B6PoKCE+8ytpH kt2Hdughgap5MZhVCFgeH34mmiNmZLrEGbRBlCLrRFZRR7N1WUXcQmsnrp0A8yOLkiRG bdTg== X-Forwarded-Encrypted: i=1; AHgh+RrLwHugm6891dp3+JcQT+FNaoeIBHm77EJdRcZC3dZeBKqtbl24xtKkeAZfa+hocXyGOhXutkhAumCG1b8=@vger.kernel.org X-Gm-Message-State: AOJu0Yy8WrvwjP/85gplliZtStTlDfJLBv3W/CXitMA7bJLCMYn/rdII 0KDzG+Ohk0A5zIxhDeOqcXziYTz9V3UWENTfa7mRHJhTlbHhilSRpG+W X-Gm-Gg: AfdE7ckr+OQQj8Tt4ZOSoW2GZ0D1xQqX1Zqymc5ZeZHz5inaiWenJP7puZYJMEIHooP akua2mUDGxSfLH9YM5SP3UDRFLR2XzM1Kp6yMKnWsxeOPMX1HZOWhvvV68rdHRHOJI9twDO3UfX Mu4njX0uOoABUtAJDPzc729sDozXRCclS5MFVPfuLb7RErPCKqSJR8s5XFgxJ6yLEDpyEOQRm5v RiS1K8+YbkRBeaGliqcmUL5FK5QxYC3hRLS1EW5kThrjMd6K9NsAW2jxVHOycOPMR0h0or15xHd rVdmIldwilZ8k4W+rSEn7dHJZsyT1uofavZ+5avBTvb/MMxPE/WN+9gZ0S13MbAxX0nB4brqqcf h8sT3ECNwDgJhSjaPYQzJ8ct5omHQFTASDg6fQrDgTjlFlWaK8C43uPAwDuX8mYpq7fkRjS9I0i eZpGFhf51XkA== X-Received: by 2002:a17:903:2443:b0:2c9:cf62:6f61 with SMTP id d9443c01a7336-2ccea3d068cmr12460625ad.17.1783493159585; Tue, 07 Jul 2026 23:45:59 -0700 (PDT) Received: from lgs.. ([101.76.249.46]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2ccc9bdb9bbsm23455385ad.4.2026.07.07.23.45.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jul 2026 23:45:59 -0700 (PDT) From: Guangshuo Li To: Greg Kroah-Hartman , Kees Cook , Duoming Zhou , Guangshuo Li , Li Yang , Anatolij Gustschin , linux-usb@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org Subject: [PATCH] usb: phy: fsl-usb: clear fsl_otg_dev after freeing it Date: Wed, 8 Jul 2026 14:45:49 +0800 Message-ID: <20260708064549.719147-1-lgs201920130244@gmail.com> X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit fsl_otg_dev is a file-scoped singleton pointer and is used by fsl_otg_conf() to decide whether the OTG device has already been initialized. fsl_otg_remove() frees fsl_otg_dev but leaves the global pointer unchanged. A later bind can therefore see a non-NULL dangling pointer, skip initialization, and continue using freed memory through the global fsl_otg_dev pointer. Clear fsl_otg_dev after freeing it so that a later probe does not treat a dangling pointer as an initialized device. Fixes: 0807c500a1a6 ("USB: add Freescale USB OTG Transceiver driver") Signed-off-by: Guangshuo Li --- drivers/usb/phy/phy-fsl-usb.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/usb/phy/phy-fsl-usb.c b/drivers/usb/phy/phy-fsl-usb.c index 35d79f11b03d..0b5e937633f4 100644 --- a/drivers/usb/phy/phy-fsl-usb.c +++ b/drivers/usb/phy/phy-fsl-usb.c @@ -997,6 +997,7 @@ static void fsl_otg_remove(struct platform_device *pdev) fsl_otg_uninit_timers(); kfree(fsl_otg_dev->phy.otg); kfree(fsl_otg_dev); + fsl_otg_dev = NULL; if (pdata->exit) pdata->exit(pdev); -- 2.43.0