* [PATCH] tools: bpf_jit_disasm: check for klogctl failure
@ 2016-05-05 22:39 Colin King
2016-05-05 22:46 ` Daniel Borkmann
0 siblings, 1 reply; 3+ messages in thread
From: Colin King @ 2016-05-05 22:39 UTC (permalink / raw)
To: David S . Miller, netdev; +Cc: linux-kernel
From: Colin Ian King <colin.king@canonical.com>
klogctl can fail and return -ve len, so check for this and
return NULL to avoid passing a (size_t)-1 to malloc.
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
tools/net/bpf_jit_disasm.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/tools/net/bpf_jit_disasm.c b/tools/net/bpf_jit_disasm.c
index 5b32413..544b05a 100644
--- a/tools/net/bpf_jit_disasm.c
+++ b/tools/net/bpf_jit_disasm.c
@@ -98,6 +98,9 @@ static char *get_klog_buff(unsigned int *klen)
char *buff;
len = klogctl(CMD_ACTION_SIZE_BUFFER, NULL, 0);
+ if (len < 0)
+ return NULL;
+
buff = malloc(len);
if (!buff)
return NULL;
--
2.8.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] tools: bpf_jit_disasm: check for klogctl failure
2016-05-05 22:39 [PATCH] tools: bpf_jit_disasm: check for klogctl failure Colin King
@ 2016-05-05 22:46 ` Daniel Borkmann
2016-05-09 3:33 ` David Miller
0 siblings, 1 reply; 3+ messages in thread
From: Daniel Borkmann @ 2016-05-05 22:46 UTC (permalink / raw)
To: Colin King, David S . Miller, netdev; +Cc: linux-kernel
On 05/06/2016 12:39 AM, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> klogctl can fail and return -ve len, so check for this and
> return NULL to avoid passing a (size_t)-1 to malloc.
>
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
[ would be nice to get Cc'ed in future ... ]
Acked-by: Daniel Borkmann <daniel@iogearbox.net>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] tools: bpf_jit_disasm: check for klogctl failure
2016-05-05 22:46 ` Daniel Borkmann
@ 2016-05-09 3:33 ` David Miller
0 siblings, 0 replies; 3+ messages in thread
From: David Miller @ 2016-05-09 3:33 UTC (permalink / raw)
To: daniel; +Cc: colin.king, netdev, linux-kernel
From: Daniel Borkmann <daniel@iogearbox.net>
Date: Fri, 06 May 2016 00:46:56 +0200
> On 05/06/2016 12:39 AM, Colin King wrote:
>> From: Colin Ian King <colin.king@canonical.com>
>>
>> klogctl can fail and return -ve len, so check for this and
>> return NULL to avoid passing a (size_t)-1 to malloc.
>>
>> Signed-off-by: Colin Ian King <colin.king@canonical.com>
>
> [ would be nice to get Cc'ed in future ... ]
>
> Acked-by: Daniel Borkmann <daniel@iogearbox.net>
Applied.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-05-09 3:33 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-05-05 22:39 [PATCH] tools: bpf_jit_disasm: check for klogctl failure Colin King
2016-05-05 22:46 ` Daniel Borkmann
2016-05-09 3:33 ` David Miller
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.