[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <871q7xe0xf.fsf@geanix.com>
Date: Tue, 26 Mar 2024 11:34:52 +0100
From: Esben Haabendal <esben@...nix.com>
To: Antonio Quartulli <antonio@...nvpn.net>
Cc: netdev@...r.kernel.org, Jakub Kicinski <kuba@...nel.org>, Sergey
Ryazanov <ryazanov.s.a@...il.com>, Paolo Abeni <pabeni@...hat.com>, Eric
Dumazet <edumazet@...gle.com>
Subject: Re: [PATCH net-next v2 06/22] ovpn: introduce the ovpn_peer object
Antonio Quartulli <antonio@...nvpn.net> writes:
> +static inline bool ovpn_bind_skb_src_match(const struct ovpn_bind *bind, struct sk_buff *skb)
> +{
> + const unsigned short family = skb_protocol_to_family(skb);
> + const struct ovpn_sockaddr *sa = &bind->sa;
You should move this dereferencing of bind to after the following check
to avoid segmentation fault.
> + if (unlikely(!bind))
> + return false;
> diff --git a/drivers/net/ovpn/peer.c b/drivers/net/ovpn/peer.c
> new file mode 100644
> index 000000000000..4319271927a4
> --- /dev/null
> +++ b/drivers/net/ovpn/peer.c
> +
> +/* Use with kref_put calls, when releasing refcount
> + * on ovpn_peer objects. This method should only
> + * be called from process context with config_mutex held.
> + */
> +void ovpn_peer_release_kref(struct kref *kref)
> +{
> + struct ovpn_peer *peer = container_of(kref, struct ovpn_peer, refcount);
> +
> + INIT_WORK(&peer->delete_work, ovpn_peer_delete_work);
Is this safe, or could we end up re-initializing delete_work while it is
queued or running?
> + queue_work(peer->ovpn->events_wq, &peer->delete_work);
/Esben
Powered by blists - more mailing lists