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 942C33BA227; Mon, 23 Mar 2026 16:10:24 +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=1774282224; cv=none; b=my/UwsYT/tncCmUpeyg+jda+N0BRHAmFXW42dv5XiphGZZLffPICgCQTmv0sU/MjTOqPkOoVL/NiLUDWETMHH4g10pNPCWx+z0a8iZkla5aAD8sgitwxbzy4p0fhzntXyUVag48CNarLzh2mJkCVxzIqnU5HnWW7PAhAzNAgB84= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774282224; c=relaxed/simple; bh=+miAlD12tLnKmllvI/Cy7Q3cqPhCvhYmhsFbCckAPGs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=TocGi1PqwbPew51xLLBQjIwDbUjdbFqQum+CHnQ3o7qHRFHqdqnp6PLs8AO9bC8tHrilZ2DV03AyprWc/grB9B4NGMlbBoZFl12Er3nHanYCUbA+I0L9gJR/6MYRNhfTpVyb5EliQaStflkgt55AuOjGk5VV1L717/+DnjwFbkE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=YGhnf9z5; 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="YGhnf9z5" Received: by smtp.kernel.org (Postfix) with ESMTPSA id EFBA5C2BC9E; Mon, 23 Mar 2026 16:10:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1774282224; bh=+miAlD12tLnKmllvI/Cy7Q3cqPhCvhYmhsFbCckAPGs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YGhnf9z5Dax2wLdaV4Y9HA6h4ltnlMUhfwx5jFDFy1Od5JSym3m31jEDzOkqZVj/q S9bY/R6yjuYf97QuEP9imp4Ehh/XW0Xv9bHjZm3VUzqkG0Tj6aeJybMEcRdX3vODQV 4DlPm1Y+ullfwLVqHVPU/KPFVKyn77yV/MYc3+gs= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Marc Kleine-Budde , Vincent Mailhol , stable@kernel.org Subject: [PATCH 6.1 076/481] can: ucan: Fix infinite loop from zero-length messages Date: Mon, 23 Mar 2026 14:40:58 +0100 Message-ID: <20260323134527.084476874@linuxfoundation.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260323134525.256603107@linuxfoundation.org> References: <20260323134525.256603107@linuxfoundation.org> User-Agent: quilt/0.69 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 6.1-stable review patch. If anyone has any objections, please let me know. ------------------ From: Greg Kroah-Hartman commit 1e446fd0582ad8be9f6dafb115fc2e7245f9bea7 upstream. If a broken ucan device gets a message with the message length field set to 0, then the driver will loop for forever in ucan_read_bulk_callback(), hanging the system. If the length is 0, just skip the message and go on to the next one. This has been fixed in the kvaser_usb driver in the past in commit 0c73772cd2b8 ("can: kvaser_usb: leaf: Fix potential infinite loop in command parsers"), so there must be some broken devices out there like this somewhere. Cc: Marc Kleine-Budde Cc: Vincent Mailhol Cc: stable@kernel.org Assisted-by: gkh_clanker_2000 Signed-off-by: Greg Kroah-Hartman Link: https://patch.msgid.link/2026022319-huff-absurd-6a18@gregkh Fixes: 9f2d3eae88d2 ("can: ucan: add driver for Theobroma Systems UCAN devices") Signed-off-by: Marc Kleine-Budde Signed-off-by: Greg Kroah-Hartman --- drivers/net/can/usb/ucan.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/net/can/usb/ucan.c +++ b/drivers/net/can/usb/ucan.c @@ -747,7 +747,7 @@ static void ucan_read_bulk_callback(stru len = le16_to_cpu(m->len); /* check sanity (length of content) */ - if (urb->actual_length - pos < len) { + if ((len == 0) || (urb->actual_length - pos < len)) { netdev_warn(up->netdev, "invalid message (short; no data; l:%d)\n", urb->actual_length);