From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-qk1-f175.google.com (mail-qk1-f175.google.com [209.85.222.175]) (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 156CD82866 for ; Sun, 16 Nov 2025 02:02:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.175 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763258567; cv=none; b=GGjcx14CMylUxq3oppKMfNZy0jfHKNmKBYspE5VA9WpJp6Bxw/eNNTnuhfN+uWZ/KfkJmRBIut9HMoROO5x/vmt1nJWCBFPEnbP60u1bquOjQBcuDcK4r/dXpNH0HMEoceuIKgliQftxA5Ogm7mvP2uiyEUSjSeqJ5PznJ+BUHI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763258567; c=relaxed/simple; bh=ix3L74YT5V67SxQcvcSjcHCLWXPN7DwdUDzu7JUwpac=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=K+uLP0vooTdEc4OD1moUWnv9afZA3lIwFNreQocQBzal/E0K5vc9Ps2lFUcXMIgipUx4djzhDz62DHHwjfgrprDY8XnCrno0+gRUB6uLJcvYnzaeDOvUfGkNFDLfzyhWZn9sZ1oBkZeSiVeJJtuIMb6aEKlefrQrxT+89f5ykHY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=rowland.harvard.edu; spf=fail smtp.mailfrom=g.harvard.edu; dkim=pass (2048-bit key) header.d=rowland.harvard.edu header.i=@rowland.harvard.edu header.b=dVR64hPW; arc=none smtp.client-ip=209.85.222.175 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=rowland.harvard.edu Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=g.harvard.edu Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=rowland.harvard.edu header.i=@rowland.harvard.edu header.b="dVR64hPW" Received: by mail-qk1-f175.google.com with SMTP id af79cd13be357-8b22a30986fso298074985a.2 for ; Sat, 15 Nov 2025 18:02:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rowland.harvard.edu; s=google; t=1763258565; x=1763863365; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=pkXB0RiOx00wRtlBivyr40k1pXaqD5wN/4yTU+LCQbk=; b=dVR64hPWX38dH/Hbc+t3ataLS/k+ldyJ+MI9ha15l6pP3qxcVgApW4nfx7tKqUMKZ+ g7xEkQO+yyZzc/nNISsG948Iy2oWBSaniDnDO+T1j6s0FBQwP88r/xAAR1Bf0AR3YzUw WCOGMBkJUd7BakVQItkRFx2cSTZb+FqkcfqEEI1clsgCAeZYK/3YcO+t0Y96mFxtUCo+ yh0ePFBLnehTKv6EbKfL82PuLXNIaeV5ps5zY+OLQbXIvg9UT7hLcSl9nSfpzAE0W6l9 fsbu2mRBLwJO75W1w1a48fGTTALubjV5iZ4aa9xcJWYs2mP0+7mbCOuWTCBaoKqxvKV5 ZznA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1763258565; x=1763863365; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-gg:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=pkXB0RiOx00wRtlBivyr40k1pXaqD5wN/4yTU+LCQbk=; b=X06aoB2csozEMpWBAqj1zxA/w2KnxutZTpuTbg4gIiyCCm4t6mEsw1zVY8x8VsXnT/ 5aw1LlR4/1N6JwydGOZcekbKjX+oWe9u3uo5ti4bWX9z4XhBTjQs2nwUNrG7qNdjdeD5 IphGhFvosiFOy+lCWpOsXSQrEyK/h0OHJWPZvOMEYM5r/xbpJObMiBjiDxrudVYB+eyB uIhT/lz1+RpfgrYAs7DLvL5IXghk3IGa/9yQpOLW2M1mN3gWc9RuyxhqDik9JRTTvYU2 NXIXoZXPAAW+Wsi749fyhm/cuVDJqC1MeAL41wbMZ/u4PYxF0sNuRnvwIrzoxV8emNY7 EIAw== X-Forwarded-Encrypted: i=1; AJvYcCWDmSAhBj1mBOGTnCqhcIDWvaqWuOphRCNTmsQ1njo1JQbXROMbPcC8pcvx2h4ZvUM6p9L6wTR6ufW5HQw=@vger.kernel.org X-Gm-Message-State: AOJu0Yy50E2V6x74WOi/KSleuTN6Jt5GO4p0PP6MZOqCXMrYk3QOY9Mh cGGICivvtNR3RrvloeyHgnmx/jRpgxDaRzFJIli5Erh9WYnshTSCyk8mUNjPlfE+pg== X-Gm-Gg: ASbGnct4rZLb9tc1qfcFadIYtq69MGsDhZ/ik6nC0UTHq7bayMstvHDP2R3uWYqd5aB 7df4xevomW4yCI+CRxf7gdOdPSDL0pUb1+B3KVeqmK0pqsDSulDdR8OthDM+sBVACj3XyLlG86g fzfz2oD0oQP/C61PTDdeI+vaf1E5nPqSw9u2H5BYQBpT2jkss6zi9Nmw1qjWrMfpR0HBO/RYak6 dvxwPkRVW7VFiCry6iWZpSWeUvL2B0MMrz6F3vJBgcTJOuqlgw07JJujsXiiJPLZsA5az0O4CTY 6qtiYczQrooyIgI4o8H5IkziMIJwfdw4cSQRH+IMcZLIOXEALWhQIbHWLFeIVZtr6xOhnnkt8v0 EV/MIaiuk+Xh02Mx17oLQzkLBWH8D5mTi1N9WdMgX6mBHcLY2qulPquakyhe1MTgNUlrJRZIFFO qG4g== X-Google-Smtp-Source: AGHT+IGadHCqqKWDl62JvuYVsXnkpYDC3mZv4xvz6u4dz1J6qc7Ey4fFE9duNHKyg1jQsybJWUGC9Q== X-Received: by 2002:a05:620a:1aa5:b0:8b2:5649:25ef with SMTP id af79cd13be357-8b2c31585a3mr1026069885a.21.1763258564892; Sat, 15 Nov 2025 18:02:44 -0800 (PST) Received: from rowland.harvard.edu ([2601:19b:d03:1700::db9a]) by smtp.gmail.com with ESMTPSA id af79cd13be357-8b2aeeb4afbsm659488785a.14.2025.11.15.18.02.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 15 Nov 2025 18:02:44 -0800 (PST) Date: Sat, 15 Nov 2025 21:02:40 -0500 From: Alan Stern To: Ma Ke Cc: vz@mleia.com, piotr.wojtaszczyk@timesys.com, gregkh@linuxfoundation.org, stigge@antcom.de, arnd@arndb.de, linux-usb@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, akpm@linux-foundation.org, stable@vger.kernel.org Subject: Re: [PATCH] USB: ohci-nxp: Fix error handling in ohci-hcd-nxp driver Message-ID: <69b9818e-7db3-4c2b-80f2-29b8170a95eb@rowland.harvard.edu> References: <20251116010613.7966-1-make24@iscas.ac.cn> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20251116010613.7966-1-make24@iscas.ac.cn> On Sun, Nov 16, 2025 at 09:06:13AM +0800, Ma Ke wrote: > When obtaining the ISP1301 I2C client through the device tree, the What if the client is obtained not through the device tree but through normal I2C probing? See the isp1301_get_client() routine in drivers/usb/phy/phy-isp1301.c. > driver does not release the device reference in the probe failure path > or in the remove function. This could cause a reference count leak, > which may prevent the device from being properly unbound or freed, > leading to resource leakage. Add put_device() to release the reference > in the probe failure path and in the remove function. > > Found by code review. > > Cc: stable@vger.kernel.org > Fixes: 73108aa90cbf ("USB: ohci-nxp: Use isp1301 driver") > Signed-off-by: Ma Ke > --- > drivers/usb/host/ohci-nxp.c | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/drivers/usb/host/ohci-nxp.c b/drivers/usb/host/ohci-nxp.c > index 24d5a1dc5056..f79558ef0b45 100644 > --- a/drivers/usb/host/ohci-nxp.c > +++ b/drivers/usb/host/ohci-nxp.c > @@ -223,6 +223,8 @@ static int ohci_hcd_nxp_probe(struct platform_device *pdev) > fail_resource: > usb_put_hcd(hcd); > fail_disable: > + if (isp1301_i2c_client) This test is not needed; there is no way to get here if isp1301_i2c_client is NULL. > + put_device(&isp1301_i2c_client->dev); > isp1301_i2c_client = NULL; > return ret; > } > @@ -234,6 +236,8 @@ static void ohci_hcd_nxp_remove(struct platform_device *pdev) > usb_remove_hcd(hcd); > ohci_nxp_stop_hc(); > usb_put_hcd(hcd); > + if (isp1301_i2c_client) The same is true for this test. Alan Stern > + put_device(&isp1301_i2c_client->dev); > isp1301_i2c_client = NULL; > } > > -- > 2.17.1 >