Linux Kernel Selftest development
 help / color / mirror / Atom feed
From: Antonio Quartulli <antonio@openvpn.net>
To: Simon Horman <horms@kernel.org>
Cc: netdev@vger.kernel.org, Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Donald Hunter <donald.hunter@gmail.com>,
	Shuah Khan <shuah@kernel.org>,
	sd@queasysnail.net, ryazanov.s.a@gmail.com,
	Andrew Lunn <andrew+netdev@lunn.ch>,
	linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org
Subject: Re: [PATCH net-next v14 08/22] ovpn: implement basic RX path (UDP)
Date: Wed, 11 Dec 2024 11:00:06 +0100	[thread overview]
Message-ID: <7d986843-d184-4ed7-930f-d30ae2bc4923@openvpn.net> (raw)
In-Reply-To: <20241210164417.GA6554@kernel.org>

On 10/12/2024 17:44, Simon Horman wrote:
> On Mon, Dec 09, 2024 at 09:53:17AM +0100, Antonio Quartulli wrote:
>> Packets received over the socket are forwarded to the user device.
>>
>> Implementation is UDP only. TCP will be added by a later patch.
>>
>> Note: no decryption/decapsulation exists yet, packets are forwarded as
>> they arrive without much processing.
>>
>> Signed-off-by: Antonio Quartulli <antonio@openvpn.net>
> 
> ...
> 
>> diff --git a/drivers/net/ovpn/udp.c b/drivers/net/ovpn/udp.c
>> index c0e7aa289ad3345fcd91e7c890f70961300c356f..975392fc39bc4c0107a07a53795afecd88d72c53 100644
>> --- a/drivers/net/ovpn/udp.c
>> +++ b/drivers/net/ovpn/udp.c
>> @@ -23,9 +23,83 @@
>>   #include "bind.h"
>>   #include "io.h"
>>   #include "peer.h"
>> +#include "proto.h"
>>   #include "socket.h"
>>   #include "udp.h"
>>   
>> +/**
>> + * ovpn_udp_encap_recv - Start processing a received UDP packet.
>> + * @sk: socket over which the packet was received
>> + * @skb: the received packet
>> + *
>> + * If the first byte of the payload is DATA_V2, the packet is further processed,
>> + * otherwise it is forwarded to the UDP stack for delivery to user space.
>> + *
>> + * Return:
>> + *  0 if skb was consumed or dropped
>> + * >0 if skb should be passed up to userspace as UDP (packet not consumed)
>> + * <0 if skb should be resubmitted as proto -N (packet not consumed)
>> + */
>> +static int ovpn_udp_encap_recv(struct sock *sk, struct sk_buff *skb)
>> +{
>> +	struct ovpn_priv *ovpn;
>> +	struct ovpn_peer *peer;
>> +	u32 peer_id;
>> +	u8 opcode;
>> +
>> +	ovpn = ovpn_from_udp_sock(sk);
>> +	if (unlikely(!ovpn)) {
>> +		net_err_ratelimited("%s: cannot obtain ovpn object from UDP socket\n",
>> +				    netdev_name(ovpn->dev));
> 
> Hi Antonio,
> 
> If we reach here then ovpn is NULL.
> But the like above dereferences it.
> 
> Flagged by Smatch.

Hi Simon,
Thanks for pointing this out. I will get this fixed and add smatch to my 
test battery.

Regards,

> 
>> +		goto drop_noovpn;
>> +	}
> 
> ...
> 

-- 
Antonio Quartulli
OpenVPN Inc.


  reply	other threads:[~2024-12-11  9:59 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-09  8:53 [PATCH net-next v14 00/22] Introducing OpenVPN Data Channel Offload Antonio Quartulli
2024-12-09  8:53 ` [PATCH net-next v14 01/22] net: introduce OpenVPN Data Channel Offload (ovpn) Antonio Quartulli
2024-12-09  8:53 ` [PATCH net-next v14 02/22] ovpn: add basic netlink support Antonio Quartulli
2024-12-09  8:53 ` [PATCH net-next v14 03/22] ovpn: add basic interface creation/destruction/management routines Antonio Quartulli
2024-12-09  8:53 ` [PATCH net-next v14 04/22] ovpn: keep carrier always on for MP interfaces Antonio Quartulli
2024-12-09  8:53 ` [PATCH net-next v14 05/22] ovpn: introduce the ovpn_peer object Antonio Quartulli
2024-12-09  8:53 ` [PATCH net-next v14 06/22] ovpn: introduce the ovpn_socket object Antonio Quartulli
2024-12-09  8:53 ` [PATCH net-next v14 07/22] ovpn: implement basic TX path (UDP) Antonio Quartulli
2024-12-09  8:53 ` [PATCH net-next v14 08/22] ovpn: implement basic RX " Antonio Quartulli
2024-12-10 16:44   ` Simon Horman
2024-12-11 10:00     ` Antonio Quartulli [this message]
2024-12-09  8:53 ` [PATCH net-next v14 09/22] ovpn: implement packet processing Antonio Quartulli
2024-12-09  8:53 ` [PATCH net-next v14 10/22] ovpn: store tunnel and transport statistics Antonio Quartulli
2024-12-09  8:53 ` [PATCH net-next v14 11/22] ovpn: implement TCP transport Antonio Quartulli
2024-12-09  8:53 ` [PATCH net-next v14 12/22] ovpn: implement multi-peer support Antonio Quartulli
2024-12-09  8:53 ` [PATCH net-next v14 13/22] ovpn: implement peer lookup logic Antonio Quartulli
2024-12-09  8:53 ` [PATCH net-next v14 14/22] ovpn: implement keepalive mechanism Antonio Quartulli
2024-12-09  8:53 ` [PATCH net-next v14 15/22] ovpn: add support for updating local UDP endpoint Antonio Quartulli
2024-12-09  8:53 ` [PATCH net-next v14 16/22] ovpn: add support for peer floating Antonio Quartulli
2024-12-09  8:53 ` [PATCH net-next v14 17/22] ovpn: implement peer add/get/dump/delete via netlink Antonio Quartulli
2024-12-11  3:08   ` Xiao Liang
2024-12-11 11:31     ` Antonio Quartulli
2024-12-11 12:35       ` Xiao Liang
2024-12-11 12:52         ` Antonio Quartulli
2024-12-11 13:53           ` Xiao Liang
2024-12-11 14:07             ` Antonio Quartulli
2024-12-11 14:37               ` Xiao Liang
2024-12-09  8:53 ` [PATCH net-next v14 18/22] ovpn: implement key add/get/del/swap " Antonio Quartulli
2024-12-09  8:53 ` [PATCH net-next v14 19/22] ovpn: kill key and notify userspace in case of IV exhaustion Antonio Quartulli
2024-12-09  8:53 ` [PATCH net-next v14 20/22] ovpn: notify userspace when a peer is deleted Antonio Quartulli
2024-12-09  8:53 ` [PATCH net-next v14 21/22] ovpn: add basic ethtool support Antonio Quartulli
2024-12-09  8:53 ` [PATCH net-next v14 22/22] testing/selftests: add test tool and scripts for ovpn module Antonio Quartulli
2024-12-10 16:47   ` Simon Horman
2024-12-11 10:01     ` Antonio Quartulli

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=7d986843-d184-4ed7-930f-d30ae2bc4923@openvpn.net \
    --to=antonio@openvpn.net \
    --cc=andrew+netdev@lunn.ch \
    --cc=donald.hunter@gmail.com \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=ryazanov.s.a@gmail.com \
    --cc=sd@queasysnail.net \
    --cc=shuah@kernel.org \
    /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