🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #14434

Re: [PATCH net] can: j1939: transport: validate the DPO packet offset

#14434
From: Oleksij Rempel
Date: Wed, 11 Nov 2026 08:30
30 lines
12020 bytes
On Thu, Nov 05, 2026 at 02:59:31PM +0800, Sun Yiqi wrote:
> j1939_xtp_rx_dpo_one() stores the packet offset from a received ETP DPO
> command without checking it against the session's total packet count.
> An offset greater than or equal to that count makes
> j1939_session_skb_get() return NULL. A subsequent EOMA can then cause
> j1939_session_completed() to pass the NULL skb to j1939_sk_recv(),
> resulting in a NULL pointer dereference.
> 
> Reject an out-of-range offset before storing it and abort the session
> with J1939_XTP_ABORT_BAD_EDPO_OFFSET. Keeping the previous valid offset
> also prevents this lookup failure if an EOMA arrives while the session
> is waiting for the abort to complete.
> 
> Fixes: 9d71dd0c7009 ("can: add support of SAE J1939 protocol")
> Cc: stable@vger.kernel.org
> Signed-off-by: Sun Yiqi <sunyiqi2@huawei.com>

Sorry, i'll need to drop this patch in favor of this one:
https://lore.kernel.org/all/1794300102.11111.1000002@163.com/

Chaosheng is working on this patch longer and attempt to address
sashiko review points.


-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |
Technical Details
Message-ID: <avQnqSwcwhVIDIQJ@pengutronix.de>
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!newsfeed.bofh.team!nntp.comgw.net!eternal-september.org!feeder.eternal-september.org!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-360918-linux-kernel-netdev=dewy.ru
References: <20261105065931.1302-1-sunyiqi2@huawei.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!newsfeed.bofh.team!nntp.comgw.net!eternal-september.org!feeder.eternal-september.org!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-360918-linux-kernel-netdev=dewy.ru
From: o.rempel@pengutronix.de (Oleksij Rempel)
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net] can: j1939: transport: validate the DPO packet offset
Date: Wed, 11 Nov 2026 09:30:33 +0100
Organization: Usenet Network
Message-ID: <avQnqSwcwhVIDIQJ@pengutronix.de>
References: <20261105065931.1302-1-sunyiqi2@huawei.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Injection-Info: usenet.network;
	logging-data="811660"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:gOwNId6qvhkDiUaQiIkgCJoTKOI= sha256:7GOtUjl1ul+NNQ3ksvK9UwP8P+6mEgQ0DUcenVb1+9g=
	sha1:UYj7myMCYWiS1GGYm5Ec5rBIf3E= sha256:v8nmXo2GZ9yJxeraz+wYaEcfcQTXo0dirTZgWKHRKUk=
Content-Disposition: inline
List-ID: <netdev.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1])
	by mail.dewy.ru (Postfix) with ESMTP id 44D14113E5C; Wed, 11 Nov 2026 11:42:05 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.05
X-Spam-Status: No, score=-3.05 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1,
	DKIM_VALID_AU=-0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.249,
	MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001,
	SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key)
	header.d=pengutronix.de
X-Received: from mail.dewy.ru ([127.0.0.1])
	by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id 7P6l_FRyl-BO;
	Wed, 11 Nov 2026 11:41:57 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=104.64.211.4; helo=sin.lore.kernel.org; envelope-from=netdev+bounces-360918-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=none (p=none dis=none) header.from=pengutronix.de
X-Received: from sin.lore.kernel.org (sin.lore.kernel.org [104.64.211.4])
	by mail.dewy.ru (Postfix) with ESMTPS id ED96A113777; Wed, 11 Nov 2026 11:41:47 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by sin.lore.kernel.org (Postfix) with ESMTP id E76E3A8552; Wed, 11 Nov 2026 08:30:46 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-ARC-Seal: i=3; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
	t=1794385843;
	b=hhPRfVvrkgYSrYqXK+Ial/XYmXZiARHPi0adUupfJmR/EyS9MgzcwWiyiZcQKxR5Q/0m
	 zbHuyTFViSUNkFN8HaFVQF7TCf9VQPHyRDwJzOcYybwT8n/iB2/RdhOL55qfaq2fKmy25
	 Yl2D5CS6mbyzhgVt+/D2Z/jyyXd/+CaY1crpW8bVBQ2i/crBFIbqC3XBiGk6g5FVz1loN
	 mDjrRK2FMAkVK6SOKr3Pohq66fZC0nRGgho2a7ZIlZSV1mrnY9tFZ3S01QI740umqgGBw
	 W5QXnDyHMUaLgLRQOy+xSI518ymubYyTBoEAUbzq9Iy+DioRl9EgkQhGEVyQv0STAYg==
X-ARC-Message-Signature: i=3; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1794385843;
	h=X-Original-To:Received:DMARC-Filter:Received:DKIM-Signature:Received:
	 Received:Date:From:To:Cc:Subject:Message-ID:References:X-Mailing-List:
	 List-Id:List-Post:List-Help:List-Subscribe:List-Unsubscribe:
	 List-Owner:Precedence:MIME-Version:Content-Type:Content-Disposition:
	 In-Reply-To:X-Sent-From:X-URL:X-Accept-Language:
	 X-Accept-Content-Type;
	bh=WZLUhPOgu/Zp8GJ/VO9CF1NMJMRTVwtW3QQYGoyCbd4=;
	b=Up0B+b/RQkWsI8xdX+eaMzsbTNig0Bclzm1ouPRQo2ZyakpqXigUSV3+dtceICoNtIMS
	 /lRL+gQaNMt1WGSUeYF+fQEnKJPFIK1wmy0mVy+7lStWJDC2Al/k+R4xKN5jwOmVNd6DO
	 RW6zwOfFVMxO7iapL2d/mivDNNRej1J9/jFIkMpz937/f9r0X1FhP9a3RpwI43NQ1+veU
	 CcWISw5RGZQGajB5vwADDmx/1TPjoUqqfsvJEyfYlnFPD6DtpreCcRPm8AUcZyvpCidn1
	 h2UXuURUjrZUY8bZKkqnZGKCEHxyh/0puvtPGNZ8izBsy88aj1ZexAejRWnhCKeBh4w==
X-ARC-Authentication-Results: i=3; smtp.subspace.kernel.org; 
	dkim=pass header.d=pengutronix.de header.i=@pengutronix.de header.a=rsa-sha256 header.s=20260414 header.b="R/XGonWw";
	dmarc=none header.from=pengutronix.de;
	spf=pass smtp.mailfrom=pengutronix.de;
	arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-Received: from localhost.localdomain (localhost [127.0.0.1])
	by smtp.subspace.kernel.org (Postfix) with ESMTP id 26CB7606A336;
	Wed, 11 Nov 2026 08:30:43 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key) header.d=pengutronix.de header.i=@pengutronix.de header.a=rsa-sha256 header.s=20260414 header.b=R/XGonWw
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=185.203.200.13
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
	t=1794385837;
	b=QFgOt7ohxX0HjsdcL1AP3zsOV726kOBzox2mel822UZI/NUZtyx6Tsr6nro1sNxxtdiJ
	 Zqt2fo/LN5g+e6bMp+jRDVikFv1Zm97Ms9Y5MJmz7PoAI4lFxZbtyUkBmExttGMnTOG9z
	 BdEfrgpFS287CEps5pRQFRMvnUjeixtr65ecjR0ZuxeD4i989INTAfW8RDpji8DB4Ejrb
	 R7+nRUtPuFrQ4xCbBLWfgFyYs8zsxG23LteWvQVMtpDYAwjMS9gXsfJjJxpqnASanoxox
	 ATwTRvH42X/+AsAnUPYUcXalPIMH8ROVv8YtHyEhuhQMoKR+32FPtiioYfLzmXdTF6w==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1794385837;
	h=DMARC-Filter:Received:DKIM-Signature:Received:Received:Date:From:To:
	 Cc:Subject:Message-ID:References:MIME-Version:Content-Type:
	 Content-Disposition:In-Reply-To:X-Sent-From:X-URL:X-Accept-Language:
	 X-Accept-Content-Type;
	bh=WZLUhPOgu/Zp8GJ/VO9CF1NMJMRTVwtW3QQYGoyCbd4=;
	b=CCrlfPEXUQ+GAh+LygSsVf3dC7zUg91S/kBQ564l+Bo//ifHm/YnAo7/Irl91QhEDqnc
	 ABftr5t8OKV/5hA+MF1Rdu+7jK/tLqrRtW8siAZgo6opPlq8e4TapWPYb9Jw4wK/YJtu0
	 gDclQaH7OmUxpn8CL/mYPOJHMjb2YvY1Opx1gsZ5RVSsz+yq3JD3L9E+FxKdXr0nuHnea
	 DcqgZemjFlbKlXJQQHt+rUevgYPB9KfuYXnsvaVsVPGkfNXYMR8W1aGgl8FZvsR8qMYQM
	 NLkkW6Mj9E+GhU/eDRk9P131T1zI0q4+FuUN3whQRXUNH1ZBj4vyErHDf0jLBTLsvFA==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dmarc=none header.from=pengutronix.de;
	spf=pass smtp.mailfrom=pengutronix.de;
	dkim=pass header.d=pengutronix.de header.i=@pengutronix.de header.a=rsa-sha256 header.s=20260414 header.b="R/XGonWw";
	arc=pass header.oldest-pass=0 smtp.remote-ip=185.203.200.13
X-Received: from mx1.white.stw.pengutronix.de (mx1.white.stw.pengutronix.de [185.203.200.13])
	(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 223F0606A320;
	Wed, 11 Nov 2026 08:30:35 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 223F0606A320
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pengutronix.de
X-Received: from drehscheibe.grey.stw.pengutronix.de (drehscheibe.grey.stw.pengutronix.de [IPv6:2a0a:edc0:0:c01:1d::a2])
	(Authenticated sender: relay-from-drehscheibe.grey.stw.pengutronix.de)
	by mx1.white.stw.pengutronix.de (Postfix) with ESMTPSA id 13666201B42;
	Wed, 11 Nov 2026 09:30:34 +0100 (CET)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pengutronix.de;
	s=20260414; t=1794385834;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:cc:mime-version:mime-version:content-type:content-type:
	 in-reply-to:in-reply-to:references:references;
	bh=WZLUhPOgu/Zp8GJ/VO9CF1NMJMRTVwtW3QQYGoyCbd4=;
	b=R/XGonWwnpcVCFnliJwQ8gfzJj6VIs+qsayWUS/fEgjUpm2S2W/SjZ58HVLnGJoOrFHEFq
	B9D1fGinFn9xyOVbCv4sFxsn1mcKH/YefEMlemreoJIam8K1fdLIUx5AM2uKjBMDR/vl0w
	5wLVqsyc8uFekrwi2A7jJ92eWDmMcsnFdLJiAzNpFYTgy+c/W80lX7nSdCw9uecuf5UcJB
	dlDtCFWlYSSrUp3/uOsQlO8w3025VI819Omh2afU7wKsD+DVRSotWsHsiOULowVhkVQ4fc
	m6N5xZVi8+4M46VSZZqJELO2lUQU7bdY4n9v0aWaqaTbwMuX9oJJ8X4mIjvoVg==
X-ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=pengutronix.de;
	s=20260414; t=1794385834;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:cc:mime-version:mime-version:content-type:content-type:
	 in-reply-to:in-reply-to:references:references;
	bh=WZLUhPOgu/Zp8GJ/VO9CF1NMJMRTVwtW3QQYGoyCbd4=;
	b=JMiPjx82cveEmBXRCwPtoF6DdUEm+U/q9rQAn++X5T5/L2msVraAUrCRi4Q5VxMpkFsw2A
	eoaN1THcxeO2U5E+HWxgfIwupOlrGb8GQA3EJEdZ36/3HDBRhsnYn2KcMQLlHlWofqMxlj
	xkfCTLh5FB3tDtzrHmbH+HePIpYMPgJH6gFX5dA06wBsDhDjdnX/5AXuaV5U9CxCRbPsIz
	pT/tqq990QMxc6mVI5XRd8kdZbNIlH6Lo8sggUFFGqy/Vppr3TIev05w9MOhgIKJoCU/uK
	61InUe0rXD/GESmhiD6N0aAotrMuX/C4F6MQgdKtCAkSmxncBvoaDTHcO1cf7Q==
X-ARC-Seal: i=1; s=20260414; d=pengutronix.de; t=1794385834; a=rsa-sha256;
	cv=none;
	b=Dn1S43Ww455MeaY8DQXMYnhVErni1xx47v5TLXRh1X24ShJnPwj2NcpaNAJXLfu/uZa4yE
	alU24apeojdpkMZTyruIhGVTgrkkfHpedK778DxucmKxAP1QI6HBX6TxUqRj9vWDkJPGpS
	3OF1qp5pAlI/l46cUH/FRGo+r+RKXdX3VGSJRsNjHaFqeEOZG65J7zHkNZ86As9edplmZf
	OpKK9W580yk/9lPMYLWLyx73jouLyanXDCvjM5FOY/v3M2QTVcCR8TL7thcDR4WYuy7VaP
	f6L8Pl0t2aaQybnQjBaMQsx97B1JBpV+fNNyvGweXc4FCiHz17sDX0WrLVLfjg==
X-ARC-Authentication-Results: i=1;
	ORIGINATING;
	auth=pass smtp.auth=relay-from-drehscheibe.grey.stw.pengutronix.de smtp.mailfrom=ore@pengutronix.de
X-Received: from pty.whiteo.stw.pengutronix.de ([2a0a:edc0:2:b01:1d::c5])
	by drehscheibe.grey.stw.pengutronix.de with esmtps  (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384
	(Exim 4.96)
	(envelope-from <ore@pengutronix.de>)
	id 1xR3j0-003cTb-01;
	Wed, 11 Nov 2026 09:30:34 +0100
X-Received: from ore by pty.whiteo.stw.pengutronix.de with local (Exim 4.98.2)
	(envelope-from <ore@pengutronix.de>)
	id 1xR3iz-0000000FQsX-3ltI;
	Wed, 11 Nov 2026 09:30:33 +0100
X-Cc: robin@protonic.nl, kernel@pengutronix.de, socketcan@hartkopp.net,
	mkl@pengutronix.de, linux-can@vger.kernel.org,
	linux-kernel@vger.kernel.org, netdev@vger.kernel.org,
	stable@vger.kernel.org, luoxiaoxing@huawei.com
X-Mailing-List: netdev@vger.kernel.org
X-List-Post: <mailto:netdev@vger.kernel.org>
X-List-Help: <mailto:netdev+help@vger.kernel.org>
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>
X-List-Owner: <mailto:netdev+owner@vger.kernel.org>
X-Precedence: list
X-In-Reply-To: <20261105065931.1302-1-sunyiqi2@huawei.com>
X-Sent-From: Pengutronix Hildesheim
X-URL: http://www.pengutronix.de/
X-Accept-Language: de,en
X-Accept-Content-Type: text/plain