[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <b2fe3de8-44b7-1ba9-3543-ac8abee44bf6@gmail.com>
Date: Wed, 24 Oct 2018 09:21:01 -0600
From: David Ahern <dsahern@...il.com>
To: David Ahern <dsahern@...il.com>,
Li RongQing <lirongqing@...du.com>, netdev@...r.kernel.org,
David Miller <davem@...emloft.net>
Subject: Re: [net-next][PATCH] net/ipv4: fix a net leak
On 10/24/18 9:02 AM, David Ahern wrote:
> On 10/24/18 3:36 AM, Li RongQing wrote:
>> put net when input a invalid ifindex, otherwise it will be leaked
>>
>> Fixes: 5fcd266a9f64("net/ipv4: Add support for dumping addresses for a specific device")
>> Cc: David Ahern <dsahern@...il.com>
>> Signed-off-by: Zhang Yu <zhangyu31@...du.com>
>> Signed-off-by: Li RongQing <lirongqing@...du.com>
>> ---
>> net/ipv4/devinet.c | 4 +++-
>> 1 file changed, 3 insertions(+), 1 deletion(-)
>>
>> diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c
>> index 63d5b58fbfdb..fd0c5a47e742 100644
>> --- a/net/ipv4/devinet.c
>> +++ b/net/ipv4/devinet.c
>> @@ -1775,8 +1775,10 @@ static int inet_dump_ifaddr(struct sk_buff *skb, struct netlink_callback *cb)
>>
>> if (fillargs.ifindex) {
>> dev = __dev_get_by_index(tgt_net, fillargs.ifindex);
>> - if (!dev)
>> + if (!dev) {
>> + put_net(tgt_net);
>> return -ENODEV;
>> + }
>>
>> in_dev = __in_dev_get_rtnl(dev);
>> if (in_dev) {
>>
>
> Good catch. IPv6 has the same problem. Will fix that one.
>
Actually remove that 'Reviewed-by'. You should only call put_net if
(fillargs.netnsid >= 0)
DaveM: just want to call this out since I mistakenly added the
Reviewed-by. This patch should be dropped.
Powered by blists - more mailing lists