]> git.hungrycats.org Git - linux/commitdiff
mptcp: print new line in mptcp_seq_show() if mptcp isn't in use
authorJianguo Wu <wujianguo@chinatelecom.cn>
Sat, 5 Dec 2020 07:56:33 +0000 (15:56 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 21 Dec 2020 12:28:16 +0000 (13:28 +0100)
[ Upstream commit f55628b3e7648198e9c072b52080c5dea8678adf ]

When do cat /proc/net/netstat, the output isn't append with a new line, it looks like this:
[root@localhost ~]# cat /proc/net/netstat
...
MPTcpExt: 0 0 0 0 0 0 0 0 0 0 0 0 0[root@localhost ~]#

This is because in mptcp_seq_show(), if mptcp isn't in use, net->mib.mptcp_statistics is NULL,
so it just puts all 0 after "MPTcpExt:", and return, forgot the '\n'.

After this patch:

[root@localhost ~]# cat /proc/net/netstat
...
MPTcpExt: 0 0 0 0 0 0 0 0 0 0 0 0 0
[root@localhost ~]#

Fixes: fc518953bc9c8d7d ("mptcp: add and use MIB counter infrastructure")
Signed-off-by: Jianguo Wu <wujianguo@chinatelecom.cn>
Acked-by: Florian Westphal <fw@strlen.de>
Link: https://lore.kernel.org/r/142e2fd9-58d9-bb13-fb75-951cccc2331e@163.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
net/mptcp/mib.c

index 0a6a15f3456dcf5131e18ac8fd1ca140e0733ea6..49fca22aaba3cd8fcc5927606f920e4943a90e35 100644 (file)
@@ -58,6 +58,7 @@ void mptcp_seq_show(struct seq_file *seq)
                for (i = 0; mptcp_snmp_list[i].name; i++)
                        seq_puts(seq, " 0");
 
+               seq_putc(seq, '\n');
                return;
        }