From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 98AAF361646; Mon, 23 Feb 2026 12:14:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771848882; cv=none; b=fzQJPxUIJ0P667CC2ObUAKppKO2LtmIbgYqC7BspEAnhYR+9HEELGVtl54JyLZbGJbl7OMMlBK82BGDepxevgQAO9ZhhTdNV8a+2Q7lg5ak7xuaiBUS3YSomNKmaMme3OU42Eyf2neUcGstAAjF/hWBnaB2atY3NYORerzQ+ZKA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771848882; c=relaxed/simple; bh=ZHZvWOzjYnA9xeE0Ybqz179umPPT27pNTAzAl0o6Usc=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=bziaRTfJeUzQT9tQiBCDk4WaxVjk2a7ZUjmxLkpq/3eBoai07ZN7CTtBFFRhjwIlsmatjHmSnCC3Qs2gF7WI2PsHEHb1ZwHSUS3eJ7bE5WMAAAJDEQG35HVf1dyfpGSHa2r0Prewg4OZBF9PDO05HAxVYyP4/iCCRd335v2EfPo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=j9fYdo2v; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="j9fYdo2v" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2B2EFC116C6; Mon, 23 Feb 2026 12:14:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1771848882; bh=ZHZvWOzjYnA9xeE0Ybqz179umPPT27pNTAzAl0o6Usc=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=j9fYdo2v5HuAPHvViQDHizrXZYikpM1rDfj/jX3xbFmcg8ID3GnFGkRzyJJQUBuGS /iItGchSzzKqTM5u8XWmQ2B6NVXdbREEevR1iZvcD8WGc76c+HC5WmdXGDF02MORvP y53n2fMnjvu4bLtJPXzDZxXNljn6c6iipL000lqU= Date: Mon, 23 Feb 2026 13:14:35 +0100 From: Greg Kroah-Hartman To: Oliver Neukum Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, stable Subject: Re: [PATCH v2] usb: misc: uss720: properly clean up reference in uss720_probe() Message-ID: <2026022316-strobe-zombie-335f@gregkh> References: <2026022327-exhaust-constrain-e21d@gregkh> <04778e0c-e15c-4acd-ade2-5cb8dc4319b1@suse.com> Precedence: bulk X-Mailing-List: linux-usb@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: <04778e0c-e15c-4acd-ade2-5cb8dc4319b1@suse.com> On Mon, Feb 23, 2026 at 12:28:29PM +0100, Oliver Neukum wrote: > Hi, > > On 23.02.26 12:17, Greg Kroah-Hartman wrote: > > If get_1284_register() fails, the usb device reference count is > > incorrect and needs to be properly dropped before returning. > > > > Cc: stable > > Assisted-by: gkh_clanker_2000 > > Signed-off-by: Greg Kroah-Hartman > > --- > > v2: properly clean up the previously allocated resources by jumping to > > the error path and not just retrning directly > > > > drivers/usb/misc/uss720.c | 6 ++++-- > > 1 file changed, 4 insertions(+), 2 deletions(-) > > > > diff --git a/drivers/usb/misc/uss720.c b/drivers/usb/misc/uss720.c > > index ec8bd968c4de..54107bf280df 100644 > > --- a/drivers/usb/misc/uss720.c > > +++ b/drivers/usb/misc/uss720.c > > @@ -735,8 +735,10 @@ static int uss720_probe(struct usb_interface *intf, > > * here. */ > > ret = get_1284_register(pp, 0, ®, GFP_KERNEL); > > dev_dbg(&intf->dev, "reg: %7ph\n", priv->reg); > > - if (ret < 0) > > - return ret; > > + if (ret < 0) { > > + usb_put_dev(usbdev); > > + goto probe_abort; > > This jumps to probe_abort, which calls destroy_priv() indirectly > via kref_put(). Either that works, which would mean that you must > _not_ do a second usb_put_dev() or it does not, in which case the > earlier error handling for parport_register_port() is incorrect. > > Either way, there is a problem. Argh, I missed that part of the error path, you are right. The existing code is wrong for the earlier cleanup logic, I'll go fix that instead, thanks for the review. It's tricky stuff like this which makes me can't wait for rust to be possible for USB drivers, someday... thanks, greg k-h