Re: [nf-next PATCH] netfilter: nft_masq: fix register/unregister notifier on module _init and _exit

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Oct 03, 2014 at 02:13:36PM +0200, Arturo Borrero Gonzalez wrote:
> Let's mimic the behaviour of ipt_MASQUERADE and ip6t_MASQUERADE and
> register/unregister the masquerade notifiers on module _init and _exit.
> 
> The configuration previous to this patch may lead to spurious kernel crashes.

Applied, thanks Arturo.

I have slightly rewritten the patch title and description.

And another comment below:

> @@ -73,12 +52,19 @@ static struct nft_expr_type nft_masq_ipv4_type __read_mostly = {
>  
>  static int __init nft_masq_ipv4_module_init(void)
>  {
> -	return nft_register_expr(&nft_masq_ipv4_type);
> +	int ret;
> +
> +	ret = nft_register_expr(&nft_masq_ipv4_type);
> +	if (ret == 0)
> +		nf_nat_masquerade_ipv4_register_notifier();

The convention is to check for errors, ie.

        ret = foo();
        if (ret < 0)
                return ret;

        bar();

So the branch path returns the error or goes to error handling part to
undo things that we couldn't finish.
--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Netfitler Users]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux