From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (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 3BEE21A6839; Mon, 17 Aug 2026 14:16:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786976214; cv=none; b=p4oWDhIDxRuQ+s4xuwN3v6sGMMW/I1rnPpaCcEkgGhMJ7R9OUL7UQeHuFrdJU2Fzj4BsvWfX21slih2qGk0O/EKZpFouD0zITHF6PvTzC7JNbb3G6VeR+eGN15PdUz5z58OdKo5k3tnAQ3bihKrfTGHzhOKEW+Ek+fRzN6PlP/U= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786976214; c=relaxed/simple; bh=iz/Gto+U5WG/Th9sr0QrSnDT+magEdiywNzO0/cobbA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=WQ7fRu0Ye8/4tgpOhwkkuWZFte2nFBOP0bo5OoxLocYb6FkLdPQe+NoxkVFdNNzJWAbI6jUeE91ak1soeqS0ysTUVZxNc6cLILw6nqgJv1D4P8iixPyPCJQ7gb56i3kPnE4/pyh3cBh80rvHVwpE0Hn40i4RHAOkBerxaZaQbsw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=RsutxOvQ; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="RsutxOvQ" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 917421F000E9; Mon, 17 Aug 2026 14:16:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1786976213; bh=+HR9jxTKpY6OujSCmi3Ik6oceqdwA0VUIcshKn4LtpE=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=RsutxOvQJ6vSIXnFkXmiAyNXGvMAeF15jP1oWeWWr1U097msAgj3iWUMOfw2JIG31 vY1scXle6WkrNXYTbRSGgGZB2hGsYRywrE8jk2SNu9cmueirVoyPh18H24G+cELQmo dkuzknV1gMFG7DiADC36uRFkcvmCkF+GYZtNkvlc= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Maoyi Xie , Vincent Mailhol , Marc Kleine-Budde Subject: [PATCH 5.10 296/389] can: peak_usb: peak_usb_start(): fix double free of transfer buffer on URB submit error Date: Mon, 17 Aug 2026 15:32:15 +0200 Message-ID: <20260817132550.615599303@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260817132538.796021292@linuxfoundation.org> References: <20260817132538.796021292@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 5.10-stable review patch. If anyone has any objections, please let me know. ------------------ From: Maoyi Xie commit 9b3d5a6d952c38bbcf07f903cbeadefdb56b9bc9 upstream. In peak_usb_start(), each RX URB transfer buffer is allocated with kmalloc() and the URB is flagged URB_FREE_BUFFER so that the final usb_free_urb() also frees the transfer buffer. If usb_submit_urb() fails, the error path frees the buffer explicitly with kfree(buf) and then calls usb_free_urb(urb). Because URB_FREE_BUFFER is set, usb_free_urb() -> urb_destroy() frees the same buffer a second time, a double free of the transfer buffer. BUG: KASAN: double-free in usb_free_urb.part.0+0x91/0xb0 Free of addr ffff8881069ccb80 by task trigger.sh/285 Call Trace: kfree+0x113/0x3c0 usb_free_urb.part.0+0x91/0xb0 Drop the redundant kfree(buf); usb_free_urb() already releases the transfer buffer. This mirrors commit 03819abbeb11 ("net: usb: lan78xx: Fix double free issue with interrupt buffer allocation"). Fixes: bb4785551f64 ("can: usb: PEAK-System Technik USB adapters driver core") Closes: https://lore.kernel.org/linux-can/178159320216.2154888.16953451793788581739@maoyixie.com/T/#u Cc: stable@vger.kernel.org Signed-off-by: Maoyi Xie Reviewed-by: Vincent Mailhol Link: https://patch.msgid.link/178163373110.2507866.216458825145756798@maoyixie.com Signed-off-by: Marc Kleine-Budde Signed-off-by: Greg Kroah-Hartman --- drivers/net/can/usb/peak_usb/pcan_usb_core.c | 1 - 1 file changed, 1 deletion(-) --- a/drivers/net/can/usb/peak_usb/pcan_usb_core.c +++ b/drivers/net/can/usb/peak_usb/pcan_usb_core.c @@ -444,7 +444,6 @@ static int peak_usb_start(struct peak_us netif_device_detach(dev->netdev); usb_unanchor_urb(urb); - kfree(buf); usb_free_urb(urb); break; }