From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-oi0-f53.google.com ([209.85.218.53]:34990 "EHLO mail-oi0-f53.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751375AbcJMT5L (ORCPT ); Thu, 13 Oct 2016 15:57:11 -0400 Received: by mail-oi0-f53.google.com with SMTP id d132so112005130oib.2 for ; Thu, 13 Oct 2016 12:56:11 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: <20161013062703.GC310@x4> References: <20161011.045737.227906000874505402.davem@davemloft.net> <20161013060206.GA310@x4> <20161013060659.GB310@x4> <20161013062703.GC310@x4> From: Linus Torvalds Date: Thu, 13 Oct 2016 12:49:33 -0700 Message-ID: Subject: Re: slab corruption with current -git To: Markus Trippelsdorf Cc: Christoph Lameter , Jens Axboe , Linux Kernel Mailing List , Aaron Conole , David Miller , Pablo Neira Ayuso , linux-fsdevel , Al Viro , NetFilter , Network Development , Andrew Morton , Florian Westphal , "Theodore Ts'o" Content-Type: text/plain; charset=UTF-8 Sender: linux-fsdevel-owner@vger.kernel.org List-ID: On Wed, Oct 12, 2016 at 11:27 PM, Markus Trippelsdorf wrote: > > Yeah. > > 105 entry->orig_ops = reg; > 106 entry->ops = *reg; > 107 entry->next = NULL; So ipt_register_table() does: ret = nf_register_net_hooks(net, ops, hweight32(table->valid_hooks)); and then nf_register_net_hooks() just does for (i = 0; i < n; i++) { err = nf_register_net_hook(net, ®[i]); so if the *reg is uninitialized, it means that it's the 'ops[]' array that isn't actually really valid in "valid_hooks". Odd. They should all be initialized by xt_hook_ops_alloc(), no? That said, xt_hook_ops_alloc() itself is odd. Lookie here, this is the loop that initializes things: for (i = 0, hooknum = 0; i < num_hooks && hook_mask != 0; hook_mask >>= 1, ++hooknum) { and it makes no sense to me how that tests *both* "i < num_hools" and "hook_mask != 0". Why? Because num_hooks = hweight32(hook_mask); so it's entirely redundant. num_hooks is already how many bits are on in hook_mask, so that test is just duplicating the same thing twice ("have we done less than that number of bits" and "do we have any bits less"). I don't know. There's something odd going on. Regardless, thsi is a different problem from the nf_register_net_hook() list handling, so I'll leave it to the networking people. David? Linus