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 9ECB622541C; Mon, 20 Apr 2026 15:45:52 +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=1776699952; cv=none; b=FWOzd3c/AmFr61YJ4Ys6Mf+iaBDgSCrjCDBFAsIUugRgQeZ4D1FA+oJew4KYOhyYMM/QQy39lgce84eFddoLxLDYoQZpx2/x44fyv+HYTttqHjcY4mbncP+dAQKb7l691i5ZrCOs6ViSQoCthqavyTxsfQ6I4pQ5BU+ttR2ZdDc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776699952; c=relaxed/simple; bh=5d8j5NrSLw+mGoqbx+TJqv8ObrVcz0k7yK0HmkmEGcE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ct/JjSZCC9fwayNtFD7RN4kmLaQ1ygwe4jEi0KqF28U+fWiaGqsVqil2JszGCfgw5OkJZUtzojFxqWXdK1cpOpMFDYjvCHDnZn8xg68pBUHNpwXLGryVc87alrAur6HcTbi4VcxlUSVjARkbs8jgWkdrCkSUAdLr1Ewcc6EFjZk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=kc7DhykJ; 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="kc7DhykJ" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 35826C19425; Mon, 20 Apr 2026 15:45:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1776699952; bh=5d8j5NrSLw+mGoqbx+TJqv8ObrVcz0k7yK0HmkmEGcE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kc7DhykJyWZPm6poicgwZTY3P95qPdCLHmS1R+GbvhgeT1/ajcSyjZC07ub5Oy48O HEffAZzObW8OXZyTlYRw4Iou82Gs5necjCQenGnsXrarXMcKzJlO2l3m+SJlZ77Qri +TJU8wDAnPSuoGplQd9ZxZNZB9ho4qkN3y5AcbFc= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Sascha Hauer , Johan Hovold , Ping-Ke Shih Subject: [PATCH 7.0 34/76] wifi: rtw88: fix device leak on probe failure Date: Mon, 20 Apr 2026 17:41:45 +0200 Message-ID: <20260420153912.063125050@linuxfoundation.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260420153910.810034134@linuxfoundation.org> References: <20260420153910.810034134@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 7.0-stable review patch. If anyone has any objections, please let me know. ------------------ From: Johan Hovold commit bbb15e71156cd9f5e1869eee7207a06ea8e96c39 upstream. Driver core holds a reference to the USB interface and its parent USB device while the interface is bound to a driver and there is no need to take additional references unless the structures are needed after disconnect. This driver takes a reference to the USB device during probe but does not to release it on all probe errors (e.g. when descriptor parsing fails). Drop the redundant device reference to fix the leak, reduce cargo culting, make it easier to spot drivers where an extra reference is needed, and reduce the risk of further memory leaks. Fixes: a82dfd33d123 ("wifi: rtw88: Add common USB chip support") Reported-by: Greg Kroah-Hartman Link: https://lore.kernel.org/netdev/2026022319-turbofan-darkened-206d@gregkh/ Cc: stable@vger.kernel.org # 6.2 Cc: Sascha Hauer Signed-off-by: Johan Hovold Signed-off-by: Ping-Ke Shih Link: https://patch.msgid.link/20260306085144.12064-19-johan@kernel.org Signed-off-by: Greg Kroah-Hartman --- drivers/net/wireless/realtek/rtw88/usb.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) --- a/drivers/net/wireless/realtek/rtw88/usb.c +++ b/drivers/net/wireless/realtek/rtw88/usb.c @@ -1041,7 +1041,7 @@ static int rtw_usb_intf_init(struct rtw_ struct usb_interface *intf) { struct rtw_usb *rtwusb = rtw_get_usb_priv(rtwdev); - struct usb_device *udev = usb_get_dev(interface_to_usbdev(intf)); + struct usb_device *udev = interface_to_usbdev(intf); int ret; rtwusb->udev = udev; @@ -1067,7 +1067,6 @@ static void rtw_usb_intf_deinit(struct r { struct rtw_usb *rtwusb = rtw_get_usb_priv(rtwdev); - usb_put_dev(rtwusb->udev); kfree(rtwusb->usb_data); usb_set_intfdata(intf, NULL); }