All of lore.kernel.org
 help / color / mirror / Atom feed
From: Florian Westphal <fw@strlen.de>
To: Marcos Paulo de Souza <marcos.souza.org@gmail.com>
Cc: netfilter-devel@vger.kernel.org
Subject: Re: [PATCH] conntrack: labels: Avoid crash when labels file is not installed
Date: Tue, 25 Jul 2017 03:09:22 +0200	[thread overview]
Message-ID: <20170725010922.GA28392@breakpoint.cc> (raw)
In-Reply-To: <20170725005508.30587-1-marcos.souza.org@gmail.com>

Marcos Paulo de Souza <marcos.souza.org@gmail.com> wrote:
> [marcos@Icarus ~]$ conntrack -l something
> nfct_labelmap_new: No such file or directory
> Segmentation fault (core dumped)

conntrack should not pass NULL in the first place.
However I agree that lnf-conntrack should be more robust
so I applied this patch, thanks.

> This is my first patch to netfilter and conntrack-tools, so please let
> me know if I sent to the right place, or if the patch needs more work.

I changed patch title to 'labels: don't crash on NULL labelmap'.

>  int __labelmap_get_bit(struct nfct_labelmap *m, const char *name)
>  {
> -	unsigned int i = hash_name(name);
> +	unsigned int i;
> +	if (!m)
> +		return -1;
> +
> +	i = hash_name(name);
>  	struct labelmap_bucket *list = m->map_name[i];

I moved this a bit to avoid mixing declaration and code, but otherwise
it should be the same change.

      reply	other threads:[~2017-07-25  1:11 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-25  0:55 [PATCH] conntrack: labels: Avoid crash when labels file is not installed Marcos Paulo de Souza
2017-07-25  1:09 ` Florian Westphal [this message]

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=20170725010922.GA28392@breakpoint.cc \
    --to=fw@strlen.de \
    --cc=marcos.souza.org@gmail.com \
    --cc=netfilter-devel@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.