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 29059188015; Fri, 15 Nov 2024 06:42:23 +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=1731652943; cv=none; b=VhI8P1xiwUOzWXixxL4hSW3V/RZjE4P/MXCQ+C8C23NsAn9VqLopsj7MFLCCSXqy5OMQKKMMDAzuuw9iJG5ULW7kkSDTrfYPjEYbZKDF/lQZywJNfPXJzrRHEAknfnkF02WBu8NDIyv2HOaCPyx/HTWvIwpXhI/qTau3LVhAyZM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731652943; c=relaxed/simple; bh=iatkBtDm6nuzS5d0HkpuDKnakc+BKO3rUcQB20cngHs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=gtO4VYVheZWF9LSjcFDsr1qTvFkkqFeh8l8NLK0IA+4n1/NX2eTjxYnbYtV2IQDZO0miYGG1oXgucjY1w1r3YyDiwkIyljY8E0gWsAwUTmBvvnfTRCEWBbdGhVkdmI+e/z2uLXt17DTWz+6Knj+plx/qWE6o5SoltTFRmYQiqZc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=zGjtUQZX; 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="zGjtUQZX" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9B964C4CED0; Fri, 15 Nov 2024 06:42:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1731652943; bh=iatkBtDm6nuzS5d0HkpuDKnakc+BKO3rUcQB20cngHs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zGjtUQZXXQ1akRe7MpR2197wSoXAF5qtPpbAnDAGE59DZnmMr3sa1Rd78DgRcnlNz 2TMJA1zOhwknSpR7KnGpjL9isQI4x8dztcB8f5o2E6ZfuCsoGT4fhcn9z968dEnTeL 3VhiJIy1L197bqNfsCIZllwicyF5qfZMvKyGC5m0= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Dan Carpenter , Johan Hovold Subject: [PATCH 4.19 32/52] USB: serial: io_edgeport: fix use after free in debug printk Date: Fri, 15 Nov 2024 07:37:45 +0100 Message-ID: <20241115063724.018943719@linuxfoundation.org> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241115063722.845867306@linuxfoundation.org> References: <20241115063722.845867306@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 4.19-stable review patch. If anyone has any objections, please let me know. ------------------ From: Dan Carpenter commit 37bb5628379295c1254c113a407cab03a0f4d0b4 upstream. The "dev_dbg(&urb->dev->dev, ..." which happens after usb_free_urb(urb) is a use after free of the "urb" pointer. Store the "dev" pointer at the start of the function to avoid this issue. Fixes: 984f68683298 ("USB: serial: io_edgeport.c: remove dbg() usage") Cc: stable@vger.kernel.org Signed-off-by: Dan Carpenter Signed-off-by: Johan Hovold Signed-off-by: Greg Kroah-Hartman --- drivers/usb/serial/io_edgeport.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) --- a/drivers/usb/serial/io_edgeport.c +++ b/drivers/usb/serial/io_edgeport.c @@ -846,11 +846,12 @@ static void edge_bulk_out_data_callback( static void edge_bulk_out_cmd_callback(struct urb *urb) { struct edgeport_port *edge_port = urb->context; + struct device *dev = &urb->dev->dev; int status = urb->status; atomic_dec(&CmdUrbs); - dev_dbg(&urb->dev->dev, "%s - FREE URB %p (outstanding %d)\n", - __func__, urb, atomic_read(&CmdUrbs)); + dev_dbg(dev, "%s - FREE URB %p (outstanding %d)\n", __func__, urb, + atomic_read(&CmdUrbs)); /* clean up the transfer buffer */ @@ -860,8 +861,7 @@ static void edge_bulk_out_cmd_callback(s usb_free_urb(urb); if (status) { - dev_dbg(&urb->dev->dev, - "%s - nonzero write bulk status received: %d\n", + dev_dbg(dev, "%s - nonzero write bulk status received: %d\n", __func__, status); return; }