Article View: linux.kernel.netdev
Article #3056Re: [PATCH net-next v2 6/7] net: mctp: usblib: Add initial kunit tx tests
From: James Lee
Date: Wed, 14 Oct 2026 04:25
Date: Wed, 14 Oct 2026 04:25
57 lines
7881 bytes
7881 bytes
> [Severity: Low] > > Is completing the transfer inline here consistent with the documented > ops->send contract? > > include/linux/usb/mctp-usb.h says, for struct > mctp_usblib_tx_ops::send: > > /* Start a USB TX for @data. On returning success, the > implementation > * must arrange for mctp_usblib_tx_send_complete() to be > called at some > * later point (eg., on urb completion). > */ > > mctp_usblib_test_tx_send() instead calls > mctp_usblib_tx_send_complete() > (which runs mctp_usblib_tx_stats_update() and > mctp_usblib_tx_ctx_free()) > and then returns 0, so the tx context is already freed at the point > success is reported. The only in-tree implementer, > mctp_usb_out_complete() in drivers/net/mctp/mctp-usb.c, completes > asynchronously from URB completion. > > Nothing breaks today: mctp_usblib_tx_send() reads ctx->tx->ops.send, > buf > and ctx->len before the call and only returns the result, and both > send > sites in mctp_usblib_tx_push() touch the context afterwards only > under > if (rc). But if the library ever legitimately inspects the context > after > a successful ->send(), this harness would report it as a KASAN > use-after-free in the test rather than a driver bug. > > Would it be better to either record the context and complete it after > the > push returns, or to relax the header comment to explicitly allow > synchronous completion? > There is no "instead". The documented function is called. Inspecting the context after a send would not be legitimate. This appears to be a false positive. > [Severity: Low] > > Do the assertions in this test actually observe either of the two > properties named in the comment? Seemingly. > [Severity: High] > > Does this static_assert() compile? Yes.
Technical Details
Message-ID:
<50b4bfd4754351f49ef79c0542276d32a7409ba1.camel@codeconstruct.com.au>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-346015-linux-kernel-netdev=dewy.ruReferences:
<20260903-dev-mctp-usb-lib-test-v2-6-313cf15e0b56@codeconstruct.com.au> <178893260401.219967.13741401547777040850@kernel.org>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-346015-linux-kernel-netdev=dewy.ru From: james@codeconstruct.com.au (James Lee) Newsgroups: linux.kernel.netdev Subject: Re: [PATCH net-next v2 6/7] net: mctp: usblib: Add initial kunit tx tests Date: Wed, 14 Oct 2026 12:25:50 +0800 Organization: Usenet Network Message-ID: <50b4bfd4754351f49ef79c0542276d32a7409ba1.camel@codeconstruct.com.au> References: <20260903-dev-mctp-usb-lib-test-v2-6-313cf15e0b56@codeconstruct.com.au> <178893260401.219967.13741401547777040850@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Injection-Info: usenet.network; logging-data="2215668"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:hjkwO85PXhTYn8TnTFdMIj2aDF8= sha256:Qwdq3H2+VZXuglE0qjaK39Z8ObYTVlbZq/dTyhO/dFY= sha1:mtJPvIlXPt1omUaql9kjDquBEig= sha256:jJ3+DTgMMzVNOpzBRcOXnGTApL85ZlBnamKq2ACT6KE= 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 1444310FFD2; Wed, 14 Oct 2026 07:26:26 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: 0.351 X-Spam-Status: No, score=0.351 tagged_above=-9999 required=6.31 tests=[DCC_CHECK=1.1, DCC_REPUT_70_89=0.1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.25, MAILING_LIST_MULTI=-1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=no autolearn_force=no X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key) header.d=codeconstruct.com.au 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 0ZoiLFKOhSSb; Wed, 14 Oct 2026 07:26:23 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=104.64.211.4; helo=sin.lore.kernel.org; envelope-from=netdev+bounces-346015-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=codeconstruct.com.au X-Received: from sin.lore.kernel.org (sin.lore.kernel.org [104.64.211.4]) by mail.dewy.ru (Postfix) with ESMTPS id 465DE10D225; Wed, 14 Oct 2026 07:26:13 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.90.174.1]) by sin.lore.kernel.org (Postfix) with ESMTP id BA57A2CFF2; Wed, 14 Oct 2026 04:25:58 +0000 (UTC) X-Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9F8C74119F9; Wed, 14 Oct 2026 04:25:57 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=codeconstruct.com.au header.i=@codeconstruct.com.au header.b="jx38zYxl" X-Received: from codeconstruct.com.au (pi.codeconstruct.com.au [203.29.241.158]) (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 571F82C21D0; Wed, 14 Oct 2026 04:25:56 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=203.29.241.158 X-ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1791951957; cv=none; b=On9/YzLQVGzOd3mahYx03Tb6A0Gfl07fGy97xSMcKmgWrzlv12SlM8bOD98I05YL/SyVy8MjEdE73Tt4bQsYgGxYTjt22pxsMLeK9EG4nxOO9xPhhHP20p55KlAw9CAwLG+Unk0TLlAfmNlcA+PhtBHbrcjneGecKTpVsDF/L50= X-ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1791951957; c=relaxed/simple; bh=bO48CuVt6th8bZN2UDCZmC2Y8Qh61nEaDFqg08Ble70=; h=Message-ID:Subject:From:To:Cc:Date:In-Reply-To:References: Content-Type:MIME-Version; b=A7gUVyRLVmBBtc1CJdNEevZfkIhiAdK/7fQ6zLr4OUEgpZSCKzFeRMjAgfz+cDsFshXFDSma6pcSlhWG5d2zvrlmHO+bEYjG0PXGs/NIOutJFCkN0Vv16/vKm4Ctp+PEWbZf5+kVOmL+q0VezWjvjAEA2N169iu9eYt3gqDuWOU= X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=codeconstruct.com.au; spf=pass smtp.mailfrom=codeconstruct.com.au; dkim=pass (2048-bit key) header.d=codeconstruct.com.au header.i=@codeconstruct.com.au header.b=jx38zYxl; arc=none smtp.client-ip=203.29.241.158 X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=codeconstruct.com.au X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=codeconstruct.com.au X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=codeconstruct.com.au; s=2022a; t=1791951954; bh=ezH3BpnQanjd396/pJFVbraHVmeO2RYUq/rewNmkX/w=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=jx38zYxlVJq+fURXvDTVIjpMc3kQMeuzyvm21VcaoLzwhrVLp5C6gehwdETw4GbsN O2AUWtH1WUsETNtNlQFYw4/IZep9GcThydDBEdaDUeWGf/1dNYxLcKsp4V+5DREuf/ KL5NWuXdV9xIkQAr8VKNk3kOY5M9sBVMO//WUaROVBmGf+5sRqXnnyNKBzJRavAZMH ZBFSiXSsngK2AEYMrRUhjeQrHlb6dGx2OripQ8ev4zVCsseb246uhevEGjaHRSE8a8 1jHUfIlZGlFNll0jqlOF1RrU7yfy16ovVPiuQvq3qJI0j3/rdCR3O93Xk6hWkMfGFc 0UxUxOrKdOGNQ== X-Received: from [10.157.79.237] (49-255-141-98.sta.ip.vocus.au [49.255.141.98]) by mail.codeconstruct.com.au (Postfix) with ESMTPSA id C131D6CEE0; Wed, 14 Oct 2026 12:25:52 +0800 (AWST) X-Cc: jk@codeconstruct.com.au, matt@codeconstruct.com.au, andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, kees@kernel.org, gustavoars@kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org X-In-Reply-To: <178893260401.219967.13741401547777040850@kernel.org> X-User-Agent: Evolution 3.56.2-0+deb13u1 X-Precedence: bulk X-Mailing-List: netdev@vger.kernel.org X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org> X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>