Linux CAN drivers development
 help / color / mirror / Atom feed
From: Oliver Hartkopp <socketcan@hartkopp.net>
To: Marc Kleine-Budde <mkl@pengutronix.de>
Cc: Davide Caratti <dcaratti@redhat.com>, linux-can@vger.kernel.org
Subject: Re: [PATCH] can: add protocol counter for AF_CAN sockets
Date: Mon, 17 Mar 2025 11:14:43 +0100	[thread overview]
Message-ID: <59713f21-d2db-4ef4-ad44-077002782205@hartkopp.net> (raw)
In-Reply-To: <20250317-muscular-ancient-weasel-ad4392-mkl@pengutronix.de>



On 17.03.25 10:20, Marc Kleine-Budde wrote:
> On 16.03.2025 13:39:16, Oliver Hartkopp wrote:
>>
>>
>> On 14.03.25 13:31, Marc Kleine-Budde wrote:
>>> On 14.03.2025 12:39:49, Davide Caratti wrote:
>>>> The third column in the output of the following command:
>>>>
>>>>    # grep CAN /proc/net/protocols
>>>>
>>>> is systematically '0': use sock_prot_inuse_add() to account for the number
>>>> of sockets for each protocol on top of AF_CAN family.
>>>>
>>>> Signed-off-by: Davide Caratti <dcaratti@redhat.com>
>>>
>>> Applied to linux-can-next.
>>>
>>
>> Maybe too fast? E.g. J1939 is not handled.
>>
>> https://lore.kernel.org/linux-can/78951192-82b1-45bc-9903-d314c94cd182@hartkopp.net/T/#m87afc41fef8ec9099344c753e32b06f302cc0e39
> 
> Can IMHO  be added in a later patch.

Sure?

can_create() creates all CAN sockets, right?

With this patch the sock_prot_inuse_add() increases the counter by one 
for every CAN socket.

But only RAW/BCM/ISOTP are decrementing the prot-in-use counter when 
removing the socket.

IMO this patch introduces a bug.

Best regards,
Oliver


  reply	other threads:[~2025-03-17 10:14 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-14 11:39 [PATCH] can: add protocol counter for AF_CAN sockets Davide Caratti
2025-03-14 12:31 ` Marc Kleine-Budde
2025-03-16 12:39   ` Oliver Hartkopp
2025-03-17  9:20     ` Marc Kleine-Budde
2025-03-17 10:14       ` Oliver Hartkopp [this message]
2025-03-16 12:36 ` Oliver Hartkopp
2025-03-17 10:14   ` Davide Caratti
2025-03-17 10:21     ` Oliver Hartkopp
2025-03-17 15:50       ` Davide Caratti
2025-03-18 13:01         ` 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=59713f21-d2db-4ef4-ad44-077002782205@hartkopp.net \
    --to=socketcan@hartkopp.net \
    --cc=dcaratti@redhat.com \
    --cc=linux-can@vger.kernel.org \
    --cc=mkl@pengutronix.de \
    /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