Thread (90 messages) 90 messages, 8 authors, 2024-04-02

Re: [PATCH net-next v2 06/22] ovpn: introduce the ovpn_peer object

From: Esben Haabendal <hidden>
Date: 2024-03-26 10:34:59

Antonio Quartulli [off-list ref] 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;
quoted hunk ↗ jump to hunk
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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help