Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934683AbYCFOEx (ORCPT ); Thu, 6 Mar 2008 09:04:53 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S934428AbYCFODs (ORCPT ); Thu, 6 Mar 2008 09:03:48 -0500 Received: from viefep18-int.chello.at ([213.46.255.22]:9656 "EHLO viefep14-int.chello.at" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S934382AbYCFODn (ORCPT ); Thu, 6 Mar 2008 09:03:43 -0500 Message-ID: <47CFF9B7.5060803@trash.net> Date: Thu, 06 Mar 2008 15:03:35 +0100 From: Patrick McHardy User-Agent: Mozilla-Thunderbird 2.0.0.6 (X11/20071008) MIME-Version: 1.0 To: Pekka J Enberg CC: netfilter-devel@vger.kernel.org, clameter@sgi.com, joe@perches.com, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, Netfilter Development Mailinglist Subject: Re: [PATCH] netfilter: replace horrible hack with ksize() References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1133 Lines: 40 Pekka J Enberg wrote: > From: Pekka Enberg > > There's a horrible slab abuse in net/netfilter/nf_conntrack_extend.c that > can be replaced with a call to ksize(). This doesn't look right. > @@ -95,7 +85,7 @@ void *__nf_ct_ext_add(struct nf_conn *ct > newlen = newoff + t->len; > rcu_read_unlock(); > > - if (newlen >= ct->ext->real_len) { > + if (newlen >= ksize(ct->ext)) { This needs to look at the currently allocated size, otherwise it will always realloc when adding new extensions after having used up ksize(ct->ext) space. > new = kmalloc(newlen, gfp); And this should use ksize(newlen) and store the real length in real_len below. > if (!new) > return NULL; > @@ -114,7 +104,6 @@ void *__nf_ct_ext_add(struct nf_conn *ct > rcu_read_unlock(); > } > kfree(ct->ext); > - new->real_len = newlen; > ct->ext = new; > } -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/