Re: [RFC] can: can_create_echo_skb(): fix echo skb generation: always use skb_clone()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Oh, answering myself ...

On 17.10.20 21:13, Oliver Hartkopp wrote:


On 16.10.20 21:36, Marc Kleine-Budde wrote:
On 2/14/20 1:09 PM, Oleksij Rempel wrote:
Hi all,

any comments on this patch?

I'm going to take this patch now for 5.10....Comments?

Yes.

Removing the sk reference will lead to the effect, that you will receive the CAN frames you have sent on that socket - which is disabled by default:

https://elixir.bootlin.com/linux/latest/source/net/can/raw.c#L124

See concept here:

https://elixir.bootlin.com/linux/latest/source/Documentation/networking/can.rst#L560

How can we maintain the CAN_RAW_RECV_OWN_MSGS to be disabled by default and fix the described problem?

+    nskb = skb_clone(skb, GFP_ATOMIC);
+    if (unlikely(!nskb)) {
+        kfree_skb(skb);
+        return NULL;
      }
-    /* we can assume to have an unshared skb with proper owner */
-    return skb;
+    can_skb_set_owner(nskb, skb->sk);

skb-> sk is still set here - so everything should be fine.

Sorry for the noise.

Regards,
Oliver




[Index of Archives]     [Automotive Discussions]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]     [CAN Bus]

  Powered by Linux