From: Etienne Basset <etienne.basset@numericable.fr>
To: Paul Moore <paul.moore@hp.com>
Cc: netdev@vger.kernel.org, linux-security-module@vger.kernel.org
Subject: Re: [PATCH] netlabel: Always remove the correct address selector
Date: Wed, 22 Apr 2009 07:55:05 +0200 [thread overview]
Message-ID: <49EEB139.2050309@numericable.fr> (raw)
In-Reply-To: <20090421200422.10106.24767.stgit@flek.lan>
Hi,
Paul Moore wrote:
> The NetLabel address selector mechanism has a problem where it can get
> mistakenly remove the wrong selector when similar addresses are used. The
> problem is caused when multiple addresses are configured that have different
> netmasks but the same address, e.g. 127.0.0.0/8 and 127.0.0.0/24. This patch
> fixes the problem.
thanks Paul!
Tested-by: Etienne Basset <etienne.basset@numericable.fr>
>
> Reported-by: Etienne Basset <etienne.basset@numericable.fr>
> Signed-off-by: Paul Moore <paul.moore@hp.com>
> ---
>
> net/netlabel/netlabel_addrlist.c | 26 ++++++++++----------------
> 1 files changed, 10 insertions(+), 16 deletions(-)
>
> diff --git a/net/netlabel/netlabel_addrlist.c b/net/netlabel/netlabel_addrlist.c
> index 834c6eb..c051913 100644
> --- a/net/netlabel/netlabel_addrlist.c
> +++ b/net/netlabel/netlabel_addrlist.c
> @@ -256,13 +256,11 @@ struct netlbl_af4list *netlbl_af4list_remove(__be32 addr, __be32 mask,
> {
> struct netlbl_af4list *entry;
>
> - entry = netlbl_af4list_search(addr, head);
> - if (entry != NULL && entry->addr == addr && entry->mask == mask) {
> - netlbl_af4list_remove_entry(entry);
> - return entry;
> - }
> -
> - return NULL;
> + entry = netlbl_af4list_search_exact(addr, mask, head);
> + if (entry == NULL)
> + return NULL;
> + netlbl_af4list_remove_entry(entry);
> + return entry;
> }
>
> #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
> @@ -299,15 +297,11 @@ struct netlbl_af6list *netlbl_af6list_remove(const struct in6_addr *addr,
> {
> struct netlbl_af6list *entry;
>
> - entry = netlbl_af6list_search(addr, head);
> - if (entry != NULL &&
> - ipv6_addr_equal(&entry->addr, addr) &&
> - ipv6_addr_equal(&entry->mask, mask)) {
> - netlbl_af6list_remove_entry(entry);
> - return entry;
> - }
> -
> - return NULL;
> + entry = netlbl_af6list_search_exact(addr, mask, head);
> + if (entry == NULL)
> + return NULL;
> + netlbl_af6list_remove_entry(entry);
> + return entry;
> }
> #endif /* IPv6 */
>
>
>
next prev parent reply other threads:[~2009-04-22 5:55 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-04-21 20:04 [PATCH] netlabel: Always remove the correct address selector Paul Moore
2009-04-21 22:43 ` James Morris
2009-04-22 5:55 ` Etienne Basset [this message]
2009-04-22 7:46 ` David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=49EEB139.2050309@numericable.fr \
--to=etienne.basset@numericable.fr \
--cc=linux-security-module@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=paul.moore@hp.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).