[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <58A1519D-A1D1-4A64-BB9D-5DC94A8C33D9@didiglobal.com>
Date: Wed, 23 Jan 2019 01:58:26 +0000
From: 邵亚方(基础平台部)
<shaoyafang@...iglobal.com>
To: Martin Lau <kafai@...com>
CC: Yafang Shao <laoar.shao@...il.com>,
Lawrence Brakmo <brakmo@...com>,
"ast@...nel.org" <ast@...nel.org>,
"daniel@...earbox.net" <daniel@...earbox.net>,
"netdev@...r.kernel.org" <netdev@...r.kernel.org>
Subject: Re: [PATCH bpf-next] bpf: sock recvbuff must be limited by rmem_max
in bpf_setsockopt()
> On 23 Jan 2019, at 1:42 AM, Martin Lau <kafai@...com> wrote:
>
> On Sat, Jan 19, 2019 at 02:20:30PM +0800, Yafang Shao wrote:
>> When sock recvbuff is set by bpf_setsockopt(), the value must by limited
>> by rmem_max.
>> It is the same with sendbuff.
>>
>> Signed-off-by: Yafang Shao <laoar.shao@...il.com>
> For bug fixes, please target the bpf branch instead of bpf-next
> and please also add the Fixes tag:
> Fixes: 8c4b4c7e9ff0 ("bpf: Add setsockopt helper function to bpf”)
Sure.
Will change it and send V2.
Thanks
Yafang
> Patch LGTM,
> Acked-by: Martin KaFai Lau <kafai@...com>
>
> Cc: Lawrence Brakmo, thought?
>
>> ---
>> net/core/filter.c | 2 ++
>> 1 file changed, 2 insertions(+)
>>
>> diff --git a/net/core/filter.c b/net/core/filter.c
>> index 447dd1b..f30b58a 100644
>> --- a/net/core/filter.c
>> +++ b/net/core/filter.c
>> @@ -4111,10 +4111,12 @@ static unsigned long bpf_xdp_copy(void *dst_buff, const void *src_buff,
>> /* Only some socketops are supported */
>> switch (optname) {
>> case SO_RCVBUF:
>> + val = min_t(u32, val, sysctl_rmem_max);
>> sk->sk_userlocks |= SOCK_RCVBUF_LOCK;
>> sk->sk_rcvbuf = max_t(int, val * 2, SOCK_MIN_RCVBUF);
>> break;
>> case SO_SNDBUF:
>> + val = min_t(u32, val, sysctl_wmem_max);
>> sk->sk_userlocks |= SOCK_SNDBUF_LOCK;
>> sk->sk_sndbuf = max_t(int, val * 2, SOCK_MIN_SNDBUF);
>> break;
>> --
>> 1.8.3.1
>>
Powered by blists - more mailing lists