lists.openwall.net | lists / announce owl-users owl-dev john-users john-dev passwdqc-users yescrypt popa3d-users / oss-security kernel-hardening musl sabotage tlsify passwords / crypt-dev xvendor / Bugtraq Full-Disclosure linux-kernel linux-netdev linux-ext4 linux-hardening linux-cve-announce PHC | |
Open Source and information security mailing list archives
| ||
|
Message-Id: <1339207973-11479-1-git-send-email-gaofeng@cn.fujitsu.com> Date: Sat, 9 Jun 2012 10:12:53 +0800 From: Gao feng <gaofeng@...fujitsu.com> To: davem@...emloft.net Cc: netdev@...r.kernel.org, containers@...ts.linux-foundation.org, wfg@...ux.intel.com, Gao feng <gaofeng@...fujitsu.com> Subject: [PATCH] inetpeer: fix build failed when IPV6 not enabled commit c8a627ed06d6d49bf65015a2185c519335c4c83f (inetpeer: add namespace support for inetpeer) makes kernel bulid failed when IPV6 not enabled. fix this by adding #if IS_ENABLED(CONFIG_IPV6) Reported-by: Fengguang Wu <wfg@...ux.intel.com> Signed-off-by: Gao feng <gaofeng@...fujitsu.com> --- net/ipv4/inetpeer.c | 18 ++++++++++++------ 1 files changed, 12 insertions(+), 6 deletions(-) diff --git a/net/ipv4/inetpeer.c b/net/ipv4/inetpeer.c index 1c85273..57f694e 100644 --- a/net/ipv4/inetpeer.c +++ b/net/ipv4/inetpeer.c @@ -151,18 +151,19 @@ static int __net_init inetpeer_net_init(struct net *net) net->ipv4.peers->root = peer_avl_empty_rcu; seqlock_init(&net->ipv4.peers->lock); +#if IS_ENABLED(CONFIG_IPV6) net->ipv6.peers = kzalloc(sizeof(struct inet_peer_base), GFP_KERNEL); - if (net->ipv6.peers == NULL) - goto out_ipv6; + if (net->ipv6.peers == NULL) { + kfree(net->ipv4.peers); + return -ENOMEM; + } net->ipv6.peers->root = peer_avl_empty_rcu; seqlock_init(&net->ipv6.peers->lock); +#endif return 0; -out_ipv6: - kfree(net->ipv4.peers); - return -ENOMEM; } static void __net_exit inetpeer_net_exit(struct net *net) @@ -170,10 +171,11 @@ static void __net_exit inetpeer_net_exit(struct net *net) inetpeer_invalidate_tree(net, AF_INET); kfree(net->ipv4.peers); net->ipv4.peers = NULL; - +#if IS_ENABLED(CONFIG_IPV6) inetpeer_invalidate_tree(net, AF_INET6); kfree(net->ipv6.peers); net->ipv6.peers = NULL; +#endif } static struct pernet_operations inetpeer_ops = { @@ -433,7 +435,11 @@ static void unlink_from_pool(struct inet_peer *p, struct inet_peer_base *base, static struct inet_peer_base *family_to_base(struct net *net, int family) { +#if IS_ENABLED(CONFIG_IPV6) return family == AF_INET ? net->ipv4.peers : net->ipv6.peers; +#else + return net->ipv4.peers; +#endif } /* perform garbage collect on all items stacked during a lookup */ -- 1.7.7.6 -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@...r.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists