From: sashiko-bot@kernel.org
To: "Oliver Hartkopp" <socketcan@hartkopp.net>, linux-can@vger.kernel.org
Cc: "Marc Kleine-Budde" <mkl@pengutronix.de>,
"Vincent Mailhol" <mailhol@kernel.org>,
"Oleksij Rempel" <o.rempel@pengutronix.de>
Subject: Re: [PATCH 3/3] can: enable memcg accounting for user triggered allocations
Date: Sat, 07 Nov 2026 13:14:06 +0000 [thread overview]
Message-ID: <sashiko-outbox-202902@kernel.org> (raw)
In-Reply-To: <20261107-can-bcmlock-memcg-v1-3-482d9f5be1fd@hartkopp.net>
Thank you for your contribution! Sashiko AI review found no new issues
in this patch, but noticed 1 related pre-existing issue it does not
introduce:
- [Medium] can: j1939: non-zero setsockopt return value in
j1939_sk_setsockopt_flag() [1]
--
commit b3ee6688711331e68a7e275f9b72d5b3fa8b7ee5
Author: Oliver Hartkopp <socketcan@hartkopp.net>
can: enable memcg accounting for user triggered allocations
This commit enables memcg accounting via GFP_KERNEL_ACCOUNT and
SLAB_ACCOUNT for user-triggered allocations in the CAN core, BCM, ISOTP,
J1939, and RAW socket protocols.
Link: https://lore.kernel.org/linux-can/350df96b-5f69-490e-b39e-ed6e9bca4754@hartkopp.net/
> diff --git a/net/can/j1939/socket.c b/net/can/j1939/socket.c
> index 50a598ef5fd4a..c832465876049 100644
> --- a/net/can/j1939/socket.c
> +++ b/net/can/j1939/socket.c
> @@ -716,9 +716,14 @@ static int j1939_sk_setsockopt(struct socket *sock, int level, int optname,
> return -EINVAL;
>
> count = optlen / sizeof(*filters);
> - filters = memdup_sockptr(optval, optlen);
> - if (IS_ERR(filters))
> - return PTR_ERR(filters);
> + filters = kmalloc(optlen, GFP_KERNEL_ACCOUNT);
> + if (!filters)
> + return -ENOMEM;
> +
> + if (copy_from_sockptr(filters, optval, optlen)) {
> + kfree(filters);
> + return -EFAULT;
> + }
>
> for (f = filters, c = count; c; f++, c--) {
> f->name &= f->name_mask;
[Severity: Medium]
This problem wasn't introduced by this patch, but should
j1939_sk_setsockopt_flag() return 0 instead of tmp [1]?
net/can/j1939/socket.c:j1939_sk_setsockopt_flag() {
...
lock_sock(&jsk->sk);
if (tmp)
jsk->state |= flag;
else
jsk->state &= ~flag;
release_sock(&jsk->sk);
return tmp;
}
When userspace enables SO_J1939_PROMISC or SO_J1939_ERRQUEUE with a
non-zero value in j1939_sk_setsockopt(), that value is returned to
userspace from setsockopt(), breaking callers that check for a 0 return on
success.
[1] https://sashiko.dev/#/bug/linux-35e22274-4165-4b2b-985e-c5f5773b9ef9
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261107-can-bcmlock-memcg-v1-0-482d9f5be1fd@hartkopp.net?part=3
next prev parent reply other threads:[~2026-11-07 13:14 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-07 13:06 [PATCH 0/3] can: bcm: avoid RTNL stalls and enable memcg accounting Oliver Hartkopp
2026-11-07 13:06 ` [PATCH 1/3] can: bcm: copy the CAN frames outside of lock_sock() Oliver Hartkopp
2026-11-07 13:15 ` sashiko-bot
2026-11-07 13:29 ` Oliver Hartkopp
2026-11-09 2:18 ` netdev-bot+sashiko
2026-11-09 7:56 ` Oliver Hartkopp
2026-11-07 13:06 ` [PATCH 2/3] can: bcm: do not remove the procfs entry in bcm_notify() Oliver Hartkopp
2026-11-09 2:18 ` netdev-bot+sashiko
2026-11-09 8:00 ` Oliver Hartkopp
2026-11-07 13:06 ` [PATCH 3/3] can: enable memcg accounting for user triggered allocations Oliver Hartkopp
2026-11-07 13:14 ` sashiko-bot [this message]
2026-11-07 13:35 ` Oliver Hartkopp
2026-11-08 8:23 ` Oleksij Rempel
2026-11-08 8:21 ` Oleksij Rempel
2026-11-08 8:25 ` Oleksij Rempel
2026-11-09 2:18 ` netdev-bot+sashiko
2026-11-09 8:09 ` 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-202902@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 \
/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.