From patchwork Sun Sep 1 19:30:26 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Wouters X-Patchwork-Id: 271637 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 37CEB2C0095 for ; Mon, 2 Sep 2013 05:30:34 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756338Ab3IATaa (ORCPT ); Sun, 1 Sep 2013 15:30:30 -0400 Received: from mx1.redhat.com ([209.132.183.28]:53170 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755958Ab3IATaa (ORCPT ); Sun, 1 Sep 2013 15:30:30 -0400 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r81JUSa7016367 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Sun, 1 Sep 2013 15:30:28 -0400 Received: from bofh.nohats.ca (vpn-58-49.rdu2.redhat.com [10.10.58.49]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r81JURjP006158; Sun, 1 Sep 2013 15:30:27 -0400 Message-ID: <522395D2.7080209@redhat.com> Date: Sun, 01 Sep 2013 15:30:26 -0400 From: Paul Wouters User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130625 Thunderbird/17.0.7 MIME-Version: 1.0 To: James Morris , "David S. Miller" CC: netdev@vger.kernel.org Subject: [PATCH] Fix for loading non-namespace aware ipv4 protocols without CONFIG_NAMESPACES X-Enigmail-Version: 1.5.2 X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Attached is a trivial patch to allow inet_add_protocol on kernels without CONFIG_NAMESPACES to load non-namespace aware (out of kernel) modules. For IPv6, there is no such check. Some discussion of that can be found in the archive: http://www.spinics.net/lists/netdev/msg225184.html I'm ambivalent on whether the check should be there (like in ipv4) or not (like in ipv6). But if it is there, it should use the proper #ifdef. Paul commit 9e3ddb21568284fb9061a91bbd3158909b1dec45 Author: Paul Wouters Date: Sun Sep 1 15:18:37 2013 -0400 * Fix for loading non-namespace aware ipv4 protocols without CONFIG_NAMESPACES set. IPv6 does not have this check. diff --git a/net/ipv4/protocol.c b/net/ipv4/protocol.c index ce84846..b5f785c 100644 --- a/net/ipv4/protocol.c +++ b/net/ipv4/protocol.c @@ -37,11 +37,13 @@ const struct net_offload __rcu *inet_offloads[MAX_INET_PROTOS] __read_mostly; int inet_add_protocol(const struct net_protocol *prot, unsigned char protocol) { +#ifdef CONFIG_NAMESPACES if (!prot->netns_ok) { pr_err("Protocol %u is not namespace aware, cannot register.\n", protocol); return -EINVAL; } +#endif return !cmpxchg((const struct net_protocol **)&inet_protos[protocol], NULL, prot) ? 0 : -1;