From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=211.75.126.72 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796023294; b=WHdQiZUBDJdwGuyIA7kWyRnP68eoFFqgf4fyJ/j1mEaH3kkzYg7YZRYp11hqf0Vhrx38 ELd2wzI+r488akfPySNPpccomUE9drIT+sH4pYury1ruND8NvBbmzl7hMCMZpDKj1Wmva /B6sF1EAzI/EzZSnY0xYuasGwVLpRNWQqWOAnGrNtcNBuid4KsPaW7Sz26p4vBIz2dtw0 Xasa/ZKFh4PhKARCcN99IC38iEhmvGiemckKN17kcLjZTqvSAXW736pJZn64YQ6vegz+Q 0d/vRffJgXrKrd/rc+AzVuLAKNG4a33eo34ACFQvahCBqfBOA5JKzqD8XiWG9Wz6Ukg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796023294; h=DMARC-Filter:X-SpamFilter-By:DKIM-Signature:Received:Received: Received:Received:From:To:CC:Subject:Thread-Topic:Thread-Index:Date: Message-ID:References:In-Reply-To:Accept-Language:Content-Language: x-originating-ip:Content-Type:Content-Transfer-Encoding:MIME-Version; bh=/RGjz7oN+7DcRIT1caLqXQKPpUieJ4HSYwiMhJAFJiE=; b=jifEOxhRYT+tXwvSgbwtU8aSvSgbwgtmuqC6fe4x8FYGgXQr64ZNcubFT2WDdLum2OsD CF0pKZGPWecCtMAQPOyenkCPQc9+UBWimfCazRTI2NwnXyBzmYxA7iSUubRzTeF+FdaX2 rSuD1+99NdOjnRPaE4bFhnBpCNsvCn3tzlRym6d95NvIBhRA6bPSxAKUpvByugdKTAs2o zneZkONAlN4YI1m63Tc2+9OcN24D2rqJvpJgtdatEI7fKW4LV2zPZeK1KkKyRrgDQDUeO bE9obdQbMHeI/JhugrE/oObNakiKQRYP0eCI5HXLRM55nzgsAvkoyPVbI/qcJF0fiuA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=realtek.com; spf=pass smtp.mailfrom=realtek.com; dkim=pass header.d=realtek.com header.i=@realtek.com header.a=rsa-sha256 header.s=dkim header.b=IP6rQ0WY; arc=none smtp.remote-ip=211.75.126.72 Received: from rtits2.realtek.com.tw (rtits2.realtek.com [211.75.126.72]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0CC8F606A31C for ; Mon, 30 Nov 2026 07:21:32 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 0CC8F606A31C Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=realtek.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=realtek.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=realtek.com header.i=@realtek.com header.a=rsa-sha256 header.s=dkim header.b=IP6rQ0WY X-SpamFilter-By: ArmorX SpamTrap 5.80 with qID 6AU7KqVwA3154640, This message is accepted by code: ctloc85258 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=realtek.com; s=dkim; t=1796023252; bh=/RGjz7oN+7DcRIT1caLqXQKPpUieJ4HSYwiMhJAFJiE=; h=From:To:CC:Subject:Date:Message-ID:References:In-Reply-To: Content-Type:Content-Transfer-Encoding:MIME-Version; b=IP6rQ0WYKZwbx4UxXvcuf0zyICXCCWxUJvjxm4HtQZSqISH4MTBTCVFxTFyVDWY2k GkN3y8Tmea9YNyHdORaKTRJsE98EFKfm194d3SITlsUZqMgPsj5wG906Qsl4+Sci76 bmrQMOJ18z1X0kkB4DnV3P0P1rs5orjtsBzbGEIOVzmebsCDXXg+toxoamkKaLhC5x ib2GvYOriL1j8buC8FARIWdiY2a12gB1noexigumqcDr5lTOgBITYmYQ79bEkvr7Jd H6eSgbFIEIKGZ+8fmQkcwwfRc7I5YY6kT3tvvfe96iPwNe6hb68PF19LCsDLIiZced bdACwwVcZJiHw== Received: from mail.realtek.com (rtkexhmbs03.realtek.com.tw[10.21.1.53]) by rtits2.realtek.com.tw (8.15.2/3.29/5.94) with ESMTPS id 6AU7KqVwA3154640 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 30 Nov 2026 15:20:52 +0800 Received: from RTKEXHMBS06.realtek.com.tw (10.21.1.56) by RTKEXHMBS03.realtek.com.tw (10.21.1.53) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.56; Mon, 30 Nov 2026 15:20:53 +0800 Received: from RTKEXHMBS06.realtek.com.tw (10.21.1.56) by RTKEXHMBS06.realtek.com.tw (10.21.1.56) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.56; Mon, 30 Nov 2026 15:20:53 +0800 Received: from RTKEXHMBS06.realtek.com.tw ([fe80::eeeb:c765:ca73:5eef]) by RTKEXHMBS06.realtek.com.tw ([fe80::eeeb:c765:ca73:5eef%10]) with mapi id 15.02.2562.056; Mon, 30 Nov 2026 15:20:53 +0800 From: Ping-Ke Shih To: Wanhui Fu , "linville@tuxdriver.com" , "jussi.kivilinna@iki.fi" CC: "linux-wireless@vger.kernel.org" Subject: RE: [PATCH] rtlwifi: usb: Fix a memory leak on URB submission failure Thread-Topic: [PATCH] rtlwifi: usb: Fix a memory leak on URB submission failure Thread-Index: AQHdgJDKaNjgGJ1dU02nKAeEmqrQTLdGNTKw Date: Mon, 30 Nov 2026 07:20:52 +0000 Message-ID: <5fd3b2868ff84acf963db491babeab47@realtek.com> References: <20261130060437.2257472-1-fuwh1120@163.com> In-Reply-To: <20261130060437.2257472-1-fuwh1120@163.com> Accept-Language: en-US, zh-TW Content-Language: zh-TW Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Wanhui Fu wrote: > _rtl_prep_rx_urb() allocates a buffer. If usb_submit_urb() Will reword as "allocates a coherent buffer". No need to resend because of this. > fails, this buffer is not anchored in rx_cleanup_urbs, > thus no cleaup callback invoked, casuing a memory leak. >=20 > Free the coherent buffer before freeing the URB on this > error path. >=20 > Found it by a self-developed static analysis tool and > compile-test passed. >=20 > Fixes: 872de8ff0492 ("rtlwifi: usb: use usb_alloc_coherent for RX buffers= ") > Signed-off-by: Wanhui Fu Acked-by: Ping-Ke Shih