[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAHA+R7MOAKdyrhS3eaxkfou+xKZmQ_DzzdjdEjV3yszdnjQtNA@mail.gmail.com>
Date: Tue, 14 Oct 2014 14:27:00 -0700
From: Cong Wang <cwang@...pensource.com>
To: David Miller <davem@...emloft.net>
Cc: Cong Wang <xiyou.wangcong@...il.com>,
netdev <netdev@...r.kernel.org>, rds-devel@....oracle.com,
chien.yen@...cle.com,
Stephen Hemminger <stephen@...workplumber.org>
Subject: Re: [Patch net] rds: avoid calling sock_kfree_s() on allocation failure
On Tue, Oct 14, 2014 at 2:03 PM, David Miller <davem@...emloft.net> wrote:
> From: Cong Wang <xiyou.wangcong@...il.com>
> Date: Tue, 14 Oct 2014 12:35:08 -0700
>
>> From: Cong Wang <cwang@...pensource.com>
>>
>> It is okay to free a NULL pointer but not okay to mischarge the socket optmem
>> accounting. Compile test only.
>>
>> Reported-by: rucsoftsec@...il.com
>> Cc: Chien Yen <chien.yen@...cle.com>
>> Cc: Stephen Hemminger <stephen@...workplumber.org>
>> Signed-off-by: Cong Wang <cwang@...pensource.com>
>> Signed-off-by: Cong Wang <xiyou.wangcong@...il.com>
>
> Applied, and I'm going to add the following bug check to the tree too.
>
> ====================
> [PATCH] net: Trap attempts to call sock_kfree_s() with a NULL pointer.
>
> Unlike normal kfree() it is never right to call sock_kfree_s() with
> a NULL pointer, because sock_kfree_s() also has the side effect of
> discharging the memory from the sockets quota.
>
> Signed-off-by: David S. Miller <davem@...emloft.net>
Acked-by: Cong Wang <cwang@...pensource.com>
Sounds reasonable. It could catch more bugs similar to this one.
Thanks!
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists