On Sun, 4 Sep 2011 01:06:02 +0200
Luka Perkov <open...@lukaperkov.net> wrote:
> > What are you actually trying to fix with enabling preemption? I didn't
> > really get it by reading your mail.
> 
> Kernel oops that I described.

Yeah. And that is completely unacceptable.

> CONFIG_PREEMPT must be enabled; don't know what more I can do.

No. You must provide a full OOPS message.
An unaligned access is easy to fix (or at least work around properly)
with proper debugging information.

> --- a/net/ipv4/netfilter/nf_nat_core.c
> +++ b/net/ipv4/netfilter/nf_nat_core.c
> @@ -276,9 +276,9 @@ nf_nat_setup_info(struct nf_conn *ct,
>  
>       /* nat helper or nfctnetlink also setup binding */
>       nat = nfct_nat(ct);
> -     if (!nat) {
> +     if (unlikely(!nat)) {
>               nat = nf_ct_ext_add(ct, NF_CT_EXT_NAT, GFP_ATOMIC);
> -             if (nat == NULL) {
> +             if (unlikely(nat == NULL)) {
>                       pr_debug("failed to add NAT extension\n");
>                       return NF_ACCEPT;
>               }
> @@ -313,16 +313,17 @@ nf_nat_setup_info(struct nf_conn *ct,
>       }
>  
>       if (maniptype == IP_NAT_MANIP_SRC) {
> -             unsigned int srchash;
> +             unsigned int h;
>  
> -             srchash = hash_by_src(net, nf_ct_zone(ct),
> -                                   &ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple);
> -             spin_lock_bh(&nf_nat_lock);
> -             /* nf_conntrack_alter_reply might re-allocate exntension aera */
> +             h = hash_by_src(net, nf_ct_zone(ct),
> +                             &ct->tuplehash[IP_CT_DIR_ORIGINAL].tuple);
> +
> +             /* nf_conntrack_alter_reply might re-allocate extension area */
>               nat = nfct_nat(ct);
>               nat->ct = ct;
> -             hlist_add_head_rcu(&nat->bysource,
> -                                &net->ipv4.nat_bysource[srchash]);
> +
> +             spin_lock_bh(&nf_nat_lock);
> +             hlist_add_head_rcu(&nat->bysource, &net->ipv4.nat_bysource[h]);
>               spin_unlock_bh(&nf_nat_lock);
>       }

This doesn't seem to fix any alignment issues, does it?

-- 
Greetings, Michael.
_______________________________________________
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel

Reply via email to