Re: [PATCH net-next v11 07/23] ovpn: introduce the ovpn_socket object

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

 



On 19.11.2024 15:44, Antonio Quartulli wrote:
On 15/11/2024 15:28, Antonio Quartulli wrote:
[...]
+}
+
+static struct ovpn_socket *ovpn_socket_get(struct socket *sock)
+{
+    struct ovpn_socket *ovpn_sock;
+
+    rcu_read_lock();
+    ovpn_sock = rcu_dereference_sk_user_data(sock->sk);
+    if (!ovpn_socket_hold(ovpn_sock)) {
+        pr_warn("%s: found ovpn_socket with ref = 0\n", __func__);

Should we be more specific here and print warning with netdev_warn(ovpn_sock->ovpn->dev, ...)?

ACK must be an unnoticed leftover

I take this back.
If refcounter is zero, I'd avoid accessing any field of the ovpn_sock object, thus the pr_warn() without any reference to the device.

If it's such unlikely scenario, then should it be:

if (WARN_ON(!ovpn_socket_hold(ovpn_sock)))
    ovpn_sock = NULL;

?

--
Sergey




[Index of Archives]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux