Article View: linux.kernel.netdev
Article #27068[PATCH net v2 2/2] net: mctp: test route input with a zero-refcount socket
From: Andrew Stellman
Date: Fri, 04 Dec 2026 18:42
Date: Fri, 04 Dec 2026 18:42
68 lines
13740 bytes
13740 bytes
From: Andrew Stellman <astellman@stellman-greene.com>
Add a KUnit case for the zero-refcount socket path in
mctp_key_alloc(). Send a start-of-message packet without EOM
while the bound socket is RCU-visible with no references, and check
that its count stays zero.
The issue was found by Claude Opus 5.5 and Claude Fable 5.2
running Quality Playbook, an LLM-driven code review tool:
https://github.com/andrewstellman/quality-playbook
The test was drafted with OpenAI GPT-6 (Codex), this changelog with
OpenAI GPT-6 (Codex) and Claude Opus 5.5, and both were reviewed by me.
Suggested-by: Jeremy Kerr <jk@codeconstruct.com.au>
Signed-off-by: Andrew Stellman <astellman@stellman-greene.com>
---
Tested on net 3c8881ee9806 (7.4.0-rc5) in arm64 QEMU with KASAN: this
case failed without 1/2 and passed with it, and both MCTP KUnit suites
passed with the series.
net/mctp/test/route-test.c | 30 ++++++++++++++++++++++++++++++
1 file changed, 30 insertions(+)
diff --git a/net/mctp/test/route-test.c b/net/mctp/test/route-test.c
index f05f75bf9..6864dc732 100644
--- a/net/mctp/test/route-test.c
+++ b/net/mctp/test/route-test.c
@@ -1717,7 +1717,37 @@ static void mctp_test_route_output_extaddr_no_eids(struct kunit *test)
mctp_test_destroy_dev(dev);
}
+static void mctp_test_route_input_sk_zero_ref(struct kunit *test)
+{
+ const struct mctp_hdr hdr = RX_HDR(1, 10, 8, FL_S | FL_TO);
+ struct mctp_test_dev *dev;
+ struct mctp_dst dst;
+ struct socket *sock;
+ struct sk_buff *skb;
+ struct sock *sk;
+ int refs, rc;
+
+ __mctp_route_test_init(test, &dev, &dst, &sock, MCTP_NET_ANY);
+ sk = sock->sk;
+ refs = refcount_read(&sk->sk_refcnt);
+ skb = mctp_test_create_skb(&hdr, 10);
+ KUNIT_ASSERT_NOT_ERR_OR_NULL(test, skb);
+ mctp_test_skb_set_dev(skb, dev);
+
+ /* Model a socket still visible to RCU lookup after its last put. */
+ sock_set_flag(sk, SOCK_DEAD);
+ refcount_set(&sk->sk_refcnt, 0);
+ rc = mctp_dst_input(&dst, skb);
+ KUNIT_EXPECT_NE(test, rc, 0);
+ KUNIT_EXPECT_EQ(test, refcount_read(&sk->sk_refcnt), 0);
+ refcount_set(&sk->sk_refcnt, refs + (rc == 0));
+ sock_reset_flag(sk, SOCK_DEAD);
+
+ __mctp_route_test_fini(test, dev, &dst, sock);
+}
+
static struct kunit_case mctp_test_cases[] = {
+ KUNIT_CASE(mctp_test_route_input_sk_zero_ref),
KUNIT_CASE_PARAM(mctp_test_fragment, mctp_frag_gen_params),
KUNIT_CASE_PARAM(mctp_test_rx_input, mctp_rx_input_gen_params),
KUNIT_CASE_PARAM(mctp_test_route_input_sk, mctp_route_input_sk_gen_params),
--
2.53.0
Technical Details
Message-ID:
<20261204184258.70828-3-bugs@stellman-greene.com>Path:
mbox-mo1.pugleaf.net!news-can.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-377546-linux-kernel-netdev=dewy.ruReferences:
<20261204184258.70828-1-bugs@stellman-greene.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-can.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-377546-linux-kernel-netdev=dewy.ru
From: bugs@stellman-greene.com (Andrew Stellman)
Newsgroups: linux.kernel.netdev
Subject: [PATCH net v2 2/2] net: mctp: test route input with a zero-refcount socket
Date: Fri, 4 Dec 2026 13:42:58 -0500
Organization: Usenet Network
Message-ID: <20261204184258.70828-3-bugs@stellman-greene.com>
References: <20261204184258.70828-1-bugs@stellman-greene.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
logging-data="2834162"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:PgJZqg9ruO8CKQpxrKqIoNfPDnA= sha256:Kh+i2tiMz18B9r34kllq5CVXiaKXeT+HZ59WCaPQQG8=
sha1:WL1mdpcmfH2RVfGXOm1gcyo1QgE= sha256:paKrffvuXQJxZZ4xs8JAvIkLTxl8bdPxzEhJtcWj9CM=
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 8C3BC117C96; Fri, 4 Dec 2026 21:43:27 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.199
X-Spam-Status: No, score=-3.199 tagged_above=-9999 required=6.31
tests=[DCC_REPUT_70_89=0.1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1,
HEADER_FROM_DIFFERENT_DOMAINS=0.001, MAILING_LIST_MULTI=-1,
RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001]
autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key)
header.d=stellman-greene-com.20260707.gappssmtp.com
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 0F3cSZ7kvnfA;
Fri, 4 Dec 2026 21:43:24 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-377546-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN>
X-Authentication-Results: OpenDMARC; dmarc=none (p=none dis=none) header.from=stellman-greene.com
X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])
by mail.dewy.ru (Postfix) with ESMTPS id 0B8FF117C95; Fri, 4 Dec 2026 21:43:15 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
by sea.lore.kernel.org (Postfix) with ESMTP id 24D0761031; Fri, 4 Dec 2026 18:43:05 +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=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
t=1796409783;
b=0fwmAekT1ONLti+jEjDmJDPz2/AgZnoY/FcmrFwqtj56Cb6aDTOTlqGfb8U6P/tj7rfh
F3cIsfZRlYqkwrlKeNN26n/NQdSQnV0XKDO7D1TUyarbttgX03vOJXw7KVOTTKyV3uS3G
vhzG5PDnnomSY/hXlzVlM+vVfQQlXTF3zvjwC/CcGRcDjijhaPk3Q4Uuy5AKyXpl7y/lz
9HfbpPepRqsUFIYk2JbEwv9XNw6BXKZtejt+AZGUnBcPV3CgeeoYpPheu1l5PVuR7OUqH
nX/OvEmAGiOf5xo9BNNu9KQC1r75i8E3p2VeYIOcN3R7ylpP/Xfim35iSq34fObewKA==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
a=rsa-sha256; c=relaxed/relaxed; t=1796409783;
h=X-Original-To:Received:DMARC-Filter:Received:DKIM-Signature:
X-Google-DKIM-Signature:X-Forwarded-Encrypted:X-Gm-Message-State:
X-Gm-Gg:X-Received:Received:From:To:Cc:Subject:Date:Message-ID:
X-Mailer:In-Reply-To:References:X-Mailing-List:List-Id:List-Post:
List-Help:List-Subscribe:List-Unsubscribe:List-Owner:Precedence:
MIME-Version:Content-Transfer-Encoding;
bh=oCWzZLd3ryjTkqTmum1V2St98KwSIQkCytVTzpFrsA0=;
b=Yfb8lWzft3WWHJeSXEzd0ngieZqwAsJ4cy+/LcR4WhEJM7WC9yg1M8QA7IR2Lklu/FO7
u8UyW2IWu2+L42gsPLosR6RI7kt0eveVrC53lnJ6sRi5ztlnitbyhMzZkIjg10gjuSy1L
wfq9YOMqXq//MWQMJgq8OCv3f5Ad7U0ipApyvKxei8ZrbRMOnVTNTFfIfp3RlQbecrbc5
W0r0o9F/IYxUtBSnpn+j10hPreRNMY2HwstRc9fkAZemZwN5MtfRzGxRPYBfqwCnDF+cT
t4yBGYjXXS85dUbvglDGGA8yHmSazShjjp+WjaJVI4RzmcWu3AL1yPTHKhBL4O5El/w==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org;
dkim=pass header.d=stellman-greene-com.20260707.gappssmtp.com header.i=@stellman-greene-com.20260707.gappssmtp.com header.a=rsa-sha256 header.s=20260707 header.b=r7NCeOwR;
dmarc=none header.from=stellman-greene.com;
spf=none smtp.mailfrom=stellman-greene.com;
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 EB79F606A330;
Fri, 4 Dec 2026 18:43:02 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=stellman-greene-com.20260707.gappssmtp.com header.i=@stellman-greene-com.20260707.gappssmtp.com header.a=rsa-sha256 header.s=20260707 header.b=r7NCeOwR
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.160.176
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
t=1796409782;
b=h7ZgiHen9LyWrcZ8YegurIqQXtalF78l8r1/Uq3U8ZRdVyfnsMuBcd+5lJf2ciGbKzGI
td/7aQa54g+xCnKwNoXBnzer9k460IO9wYRBIFU/eWM65zm4NdB0+JRP7DopHzLl+/5DR
RJ5ZunmNvD+J7yE51nqYpNIVvFYw+Hwc9dIUIfl272KK3eAD4KgzWdyaPohylODZV8Z9y
jbJ4AhFIzsNLF3GWtJ1Ckg394jjtFqF07zvPJ1tziCEyY+Q0rsBM/Ywg5lRlCcWF0dFo5
nDKyN08X/bS+U5PaWkPfAtQrhOmJKwghDmevTFpi25k6lU9AL+VkoSEdqgHcnuO8lzQ==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
a=rsa-sha256; c=relaxed/relaxed; t=1796409782;
h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature:
X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received:
From:To:Cc:Subject:Date:Message-ID:X-Mailer:In-Reply-To:References:
MIME-Version:Content-Transfer-Encoding;
bh=oCWzZLd3ryjTkqTmum1V2St98KwSIQkCytVTzpFrsA0=;
b=WIkmpRle++g46iWjaoQt9+yNDTaDD+FX4mRSfDDK5EkVsUoRDbF/CnhqyzPkp0altN82
eXib8itxBh5Dc5g6Lfk3uH8vTM3vgjgxMtW2YN0+hFzxWgXdR7AI+2xa/GX1+hY62he2+
PbVwEKbTmuX+ga3wZkl1Aahfqm5ROhqemHz2oTQuIf0L2xNHhshLmZDMoj55HfPtvr3c2
tlvnhcSLZczzO4x5qBAfGh7k5M+HJMneYjjZTee5YzfFr11pHWp1Dgo1EJEYj6CEWC/Jt
zb4Rqi6DNZivX6cIBKansXxu8mHWxGfBUYbYLEALX9xDIavoJpDP0dwfB8h5ackIsRg==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org;
dmarc=none header.from=stellman-greene.com;
spf=none smtp.mailfrom=stellman-greene.com;
dkim=pass header.d=stellman-greene-com.20260707.gappssmtp.com header.i=@stellman-greene-com.20260707.gappssmtp.com header.a=rsa-sha256 header.s=20260707 header.b=r7NCeOwR;
arc=none smtp.remote-ip=209.85.160.176
X-Received: from mail-qt1-f176.google.com (mail-qt1-f176.google.com [209.85.160.176])
(using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)
key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256)
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id C1C67606A680
for <netdev@vger.kernel.org>; Fri, 4 Dec 2026 18:43:01 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org C1C67606A680
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=stellman-greene.com
X-Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=stellman-greene.com
X-Received: by mail-qt1-f176.google.com with SMTP id d75a77b69052e-53664b4860bso12928031cf.1
for <netdev@vger.kernel.org>; Fri, 04 Dec 2026 10:43:01 -0800 (PST)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=stellman-greene-com.20260707.gappssmtp.com; s=20260707; t=1796409781; x=1797014581; darn=vger.kernel.org;
h=content-transfer-encoding:mime-version:references:in-reply-to
:message-id:date:subject:cc:to:from:from:to:cc:subject:date
:message-id:reply-to:content-type;
bh=oCWzZLd3ryjTkqTmum1V2St98KwSIQkCytVTzpFrsA0=;
b=r7NCeOwRyxA6rEueg9/2TjDROHciY+21t/e0nSn5Bd/OBwM83iE60g8GFCTL5vh53w
eegZXyt4ktEWV+2CEeZDs34Cz4LNP/JPHJdcfLV3tcfX/+K3UKks+f3fETCBqRyrR6dz
wfq2EZXch4DTzvcowYY0JB3To1cx1yWDqBJZT+gjkZ/4UMWIJFzaihsdYJ3HRxWW8RgD
psBehF95hygmqy8O5oumCBqPI+2RafJZHVNzM19M3NjNWd4s9mJ4W2+LWDNra5P76Ey0
SItMpzzlllUkHPJKUzVoMWgbC4bOq8Fr2BlphXVPks18g4iUbDijreT/XTY4/acNI//s
I25A==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20260707; t=1796409781; x=1797014581;
h=content-transfer-encoding:mime-version:references:in-reply-to
:message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from
:to:cc:subject:date:message-id:reply-to:content-type;
bh=oCWzZLd3ryjTkqTmum1V2St98KwSIQkCytVTzpFrsA0=;
b=K0swk6zub71alA6/fdiMxn29xlw4AkaM3S4nO9/3gbddTd1pL6dT2Pls98xoM763eC
HUGRuC1Fwsy8LHXDV08Gqu0nnnJgw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xWCcfrVYxbV/KdfcLeHb8qnFmvWaVQwz8f9ErVs8E
ZCWZQxKxh6XRIv00TqhaUXIZxGICKJ4zn+E/nkLmvOES+YEI0lXYUtvZDy2oea2nWMhzVNHYw9g
=
X-Received: by 2002:a05:622a:4cb:b0:536:35e1:b5 with SMTP id d75a77b69052e-55e384a2f73mr43780961cf.1.1796409780627;
Fri, 04 Dec 2026 10:43:00 -0800 (PST)
X-Received: from Mac.mynetworksettings.com ([2600:4041:5c28:200:62:766c:1c4a:276e])
by smtp.gmail.com with ESMTPSA id 6a1803df08f44-921e05801f1sm28228006d6.23.2026.12.04.10.43.00
(version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256);
Fri, 04 Dec 2026 10:43:00 -0800 (PST)
X-Cc: "David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@kernel.org>,
Jakub Kicinski <kuba@kernel.org>,
Paolo Abeni <pabeni@redhat.com>,
Simon Horman <horms@kernel.org>,
netdev@vger.kernel.org,
linux-kernel@vger.kernel.org
X-Mailer: git-send-email 2.53.0
X-In-Reply-To: <20261204184258.70828-1-bugs@stellman-greene.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