[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20170215.110726.1948359807046911436.davem@davemloft.net>
Date: Wed, 15 Feb 2017 11:07:26 -0500 (EST)
From: David Miller <davem@...emloft.net>
To: aschultz@...p.net
Cc: pablo@...filter.org, netdev@...r.kernel.org, laforge@...monks.org,
Lionel.Gauthier@...ecom.fr, osmocom-net-gprs@...ts.osmocom.org,
jonas@...thpole.se
Subject: Re: [PATCH net-next v3 2/8] gtp: switch from struct socket to
struct sock for the GTP sockets
From: Andreas Schultz <aschultz@...p.net>
Date: Wed, 15 Feb 2017 08:04:56 +0100 (CET)
> ----- On Feb 14, 2017, at 6:48 PM, David S. Miller davem@...emloft.net wrote:
>
>> From: Andreas Schultz <aschultz@...p.net>
>> Date: Mon, 13 Feb 2017 16:36:18 +0100
>>
>>> + if (gtp->sk0) {
>>> + udp_sk(gtp->sk0)->encap_type = 0;
>>> + rcu_assign_sk_user_data(gtp->sk0, NULL);
>>> + sock_put(gtp->sk0);
>>> }
>>
>> This does "sock_put(NULL);" because you are assigning gtp->sk0 to
>> NULL before the sock_put() call. So you are leaking the socket,
>> at best.
>
> I don't understand how this should happen. If I where to use rcu_assign_pointer,
> then yes, but rcu_assign_sk_user_data does assign to the sk_user_data member
> of struct sock and not to the argument itself.
You are right, I misread the assignment.
Powered by blists - more mailing lists