All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Zihan Xi" <zihanx@nebusec.ai>, linux-can@vger.kernel.org
Cc: "Marc Kleine-Budde" <mkl@pengutronix.de>,
	"Oliver Hartkopp" <socketcan@hartkopp.net>,
	"Vincent Mailhol" <mailhol@kernel.org>,
	"Oleksij Rempel" <o.rempel@pengutronix.de>
Subject: Re: [PATCH net v2 1/1] can: bcm: limit RX operation resource usage per socket
Date: Wed, 28 Oct 2026 13:53:21 +0000	[thread overview]
Message-ID: <sashiko-outbox-187949@kernel.org> (raw)
In-Reply-To: <50f8970ce7800947332f6203626abbe1933997eb.1793109154.git.zihanx@nebusec.ai>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] can: misplaced kernel-doc comment above can_rx_register_internal()
--

commit 6e185f899c0a564d22495ef1e055cc4b9c9b27f0
Author: Zihan Xi <zihanx@nebusec.ai>

can: bcm: limit RX operation resource usage per socket

This patch bounds the number and total allocation size of RX operations per
BCM socket to prevent kernel memory exhaustion. It also introduces
can_rx_register_with_release() so the socket's receiver count remains
charged until the RCU grace period completes.

Link: https://bugtracker.nebusec.ai/f/11134

> diff --git a/net/can/af_can.c b/net/can/af_can.c
> index 34fe3b28d576f..a3f0ed35fbb52 100644
> --- a/net/can/af_can.c
> +++ b/net/can/af_can.c
> @@ -441,15 +441,20 @@ static struct hlist_head *can_rcv_list_find(canid_t *can_id, canid_t *mask,
>   *  -ENOMEM on missing cache mem to create subscription entry
>   *  -ENODEV unknown device
>   */
> -int can_rx_register(struct net *net, struct net_device *dev, canid_t can_id,
> -		    canid_t mask, void (*func)(struct sk_buff *, void *),
> -		    void *data, char *ident, struct sock *sk)
> +static int can_rx_register_internal(struct net *net, struct net_device *dev,
> +				    canid_t can_id, canid_t mask,
> +				    void (*func)(struct sk_buff *, void *),
> +				    void *data, char *ident, struct sock *sk,
> +				    void (*release)(struct sock *sk))

[Severity: Low]
When splitting can_rx_register() into can_rx_register_internal() and the
exported wrapper in net/can/af_can.c, can_rx_register_internal() is placed
directly beneath the existing kernel-doc comment for can_rx_register():

/**
 * can_rx_register - subscribe CAN frames from a specific interface
...
 */
static int can_rx_register_internal(struct net *net, struct net_device *dev,
				    canid_t can_id, canid_t mask,
				    void (*func)(struct sk_buff *, void *),
				    void *data, char *ident, struct sock *sk,
				    void (*release)(struct sock *sk))

Doesn't this cause scripts/kernel-doc (under W=1 builds) to warn that the
prototype is for can_rx_register_internal() instead of can_rx_register()
and that the release parameter is not described?

Should the kernel-doc comment be moved down to the exported
can_rx_register() wrapper (or updated to match the function it precedes)?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/cover.1793109154.git.zihanx@nebusec.ai?part=1

  reply	other threads:[~2026-10-28 13:53 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-27 11:18 [PATCH net 0/1] can: bcm: bound per-socket RX operation resources Zihan Xi
2026-10-27 11:18 ` [PATCH net 1/1] can: bcm: limit RX operation resource usage per socket Zihan Xi
2026-10-27 11:29   ` sashiko-bot
2026-10-27 13:08     ` zihan xi
2026-10-27 13:11       ` Marc Kleine-Budde
2026-10-27 13:22   ` Oliver Hartkopp
2026-10-28 13:43 ` [PATCH net v2 0/1] can: bcm: bound per-socket RX operation resources Zihan Xi
2026-10-28 13:43   ` [PATCH net v2 1/1] can: bcm: limit RX operation resource usage per socket Zihan Xi
2026-10-28 13:53     ` sashiko-bot [this message]
2026-10-28 14:14       ` zihan xi
2026-10-28 15:04     ` Oliver Hartkopp
2026-10-28 15:36       ` zihan xi
2026-10-28 16:04         ` Oliver Hartkopp

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=sashiko-outbox-187949@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=linux-can@vger.kernel.org \
    --cc=mailhol@kernel.org \
    --cc=mkl@pengutronix.de \
    --cc=o.rempel@pengutronix.de \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=socketcan@hartkopp.net \
    --cc=zihanx@nebusec.ai \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.