Netdev List
 help / color / mirror / Atom feed
From: James Lee <james@codeconstruct.com.au>
To: netdev-bot+sashiko@kernel.org
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
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	[thread overview]
Message-ID: <50b4bfd4754351f49ef79c0542276d32a7409ba1.camel@codeconstruct.com.au> (raw)
In-Reply-To: <178893260401.219967.13741401547777040850@kernel.org>


> [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.


  reply	other threads:[~2026-10-14  4:25 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-03  2:42 [PATCH net-next v2 0/7] net: mctp: usblib: Increase coverage of kunit testing James Lee
2026-09-03  2:42 ` [PATCH net-next v2 1/7] net: mctp: usblib: Add to parameterized kunit tests James Lee
2026-09-09  5:43   ` netdev-bot+sashiko
2026-09-03  2:42 ` [PATCH net-next v2 2/7] net: mctp: usblib: Add test for splits inside headers James Lee
2026-09-09  5:43   ` netdev-bot+sashiko
2026-10-14  4:38     ` James Lee
2026-09-09  7:12   ` Simon Horman
2026-09-14  3:14     ` James Lee
2026-09-03  2:42 ` [PATCH net-next v2 3/7] net: mctp: usblib: Add tests of invalid headers James Lee
2026-09-09  5:43   ` netdev-bot+sashiko
2026-09-03  2:42 ` [PATCH net-next v2 4/7] net: mctp: usblib: Complete rx tests James Lee
2026-09-09  5:43   ` netdev-bot+sashiko
2026-09-03  2:42 ` [PATCH net-next v2 5/7] net: mctp: usblib: Simplify allocation logic in mctp_usblib_test_rx_init James Lee
2026-09-03  2:42 ` [PATCH net-next v2 6/7] net: mctp: usblib: Add initial kunit tx tests James Lee
2026-09-09  5:43   ` netdev-bot+sashiko
2026-10-14  4:25     ` James Lee [this message]
2026-09-03  2:42 ` [PATCH net-next v2 7/7] net: mctp: usblib: Add test for failing append James Lee
2026-09-09  5:43   ` netdev-bot+sashiko
2026-10-13  9:06     ` James Lee

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=50b4bfd4754351f49ef79c0542276d32a7409ba1.camel@codeconstruct.com.au \
    --to=james@codeconstruct.com.au \
    --cc=andrew+netdev@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=gustavoars@kernel.org \
    --cc=jk@codeconstruct.com.au \
    --cc=kees@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-hardening@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=matt@codeconstruct.com.au \
    --cc=netdev-bot+sashiko@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox