net: tcp_probe: adapt tbuf size for recent changes
Subsystems (3)
PATCH 1/1 net: tcp_probe: adapt tbuf size for recent changes
With recent changes in tcp_probe module (e.g. f925d0a62d ("net: tcp_probe:
add IPv6 support")) we also need to take into account that tbuf needs to be updated as format string will be further expanded. tbuf sits on the stack in tcpprobe_read() function that is invoked when user space reads procfs file /proc/net/tcpprobe, hence not fast path as in jtcp_rcv_established(). Having a size similarly as in sctp_probe module of 256 bytes is fully sufficient for that, we need theoretical maximum of 252 bytes otherwise we could get truncated.
--- net/ipv4/tcp_probe.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/ipv4/tcp_probe.c +1 -1
@@ -218,7 +218,7 @@ static ssize_t tcpprobe_read(struct file *file, char __user *buf,return -EINVAL ;while (cnt < len) { -char tbuf[164 ]; +char tbuf[256 ];int width;/* Wait for data in buffer */
Signature · 1 line
1.7.11.7
From: Daniel Borkmann <[email protected]>
Date: Tue, 3 Sep 2013 18:24:02 +0200
Quoted 10 lines
With recent changes in
tcp_probemodule (e.g.f925d0a62d("net:tcp_probe:
add IPv6 support")) we also need to take into account that tbuf needs to be updated as format string will be further expanded. tbuf sits on the stack intcpprobe_read()function that is invoked when user space reads procfs file/proc/net/tcpprobe, hence not fast path as injtcp_rcv_established(). Having a size similarly as insctp_probemodule of 256 bytes is fully sufficient for that, we need theoretical maximum of 252 bytes otherwise we could get truncated.Signed-off-by Daniel Borkmann <[email protected]>
Applied.