netfilter: nf_ct_expect: remove the redundant slash when policy name is empty
authorLiping Zhang <liping.zhang@spreadtrum.com>
Mon, 8 Aug 2016 13:57:58 +0000 (21:57 +0800)
committerMichael Benedict <michaelbt@live.com>
Sat, 31 Aug 2019 16:16:10 +0000 (02:16 +1000)
commit2a7b22a30e44f797787372d2c58b363110ce1d51
tree58da45f00deb08c25eb9d1f4295fe1d4221f7cb2
parented0c79ff80c0720157491ffff5072320d88f222f
netfilter: nf_ct_expect: remove the redundant slash when policy name is empty

commit b173a28f62cf929324a8a6adcc45adadce311d16 upstream.

The 'name' filed in struct nf_conntrack_expect_policy{} is not a
pointer, so check it is NULL or not will always return true. Even if the
name is empty, slash will always be displayed like follows:
  # cat /proc/net/nf_conntrack_expect
  297 l3proto = 2 proto=6 src=1.1.1.1 dst=2.2.2.2 sport=1 dport=1025 ftp/
                                                                        ^

Fixes: 3a8fc53a45c4 ("netfilter: nf_ct_helper: allocate 16 bytes for the helper and policy names")
Signed-off-by: Liping Zhang <liping.zhang@spreadtrum.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Acked-by: Michal Kubecek <mkubecek@suse.cz>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
net/netfilter/nf_conntrack_expect.c