From mboxrd@z Thu Jan 1 00:00:00 1970 From: Patrick McHardy Subject: Re: [PATCH 02/10] nf_conntrack: Introduces a extension infrastructure Date: Mon, 25 Jun 2007 17:43:47 +0200 Message-ID: <467FE2B3.9090403@trash.net> References: <200706250314.l5P3EeGY021239@toshiba.co.jp> <467F925E.7090703@trash.net> <200706251535.l5PFZlux026579@toshiba.co.jp> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: 7bit Cc: rusty@rustcorp.com.au, netfilter-devel@lists.netfilter.org, pablo@netfilter.org, kadlec@blackhole.kfki.hu To: Yasuyuki KOZAKAI Return-path: In-Reply-To: <200706251535.l5PFZlux026579@toshiba.co.jp> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: netfilter-devel-bounces@lists.netfilter.org Errors-To: netfilter-devel-bounces@lists.netfilter.org List-Id: netfilter-devel.vger.kernel.org Yasuyuki KOZAKAI wrote: > Hi, Patrick, > > Thanks for your review. I'm impressed with your huge works in many areas. > I've applied your suggestions, except following. > > From: Patrick McHardy > Date: Mon, 25 Jun 2007 12:01:02 +0200 > > >>>+void *__nf_ct_ext_add(struct nf_conn *ct, enum nf_ct_ext_id id, int gfp) >> >> >>Does any caller actually use something besides GFP_ATOMIC for gfp? > > > nf_conntrack_netlink does that. I missed that, thanks. >>>+{ >>>+ struct nf_ct_ext *new; >>>+ int i, newlen, newoff; >>>+ struct nf_ct_ext_type *t; >>>+ >>>+ if (!ct->ext) >>>+ return nf_ct_ext_create(&ct->ext, id, gfp); >>>+ >>>+ if (nf_ct_ext_exist(ct, id)) >>>+ return NULL; >>>+ >>>+ rcu_read_lock(); >>>+ t = rcu_dereference(nf_ct_ext_types[id]); >>>+ BUG_ON(t == NULL); >>>+ >>>+ newoff = ALIGN(ct->ext->len, t->align); >>>+ newlen = newoff + t->len; >>>+ rcu_read_unlock(); >>>+ >>>+ if (newlen >= ct->ext->real_len) { >>>+ new = kmalloc(newlen, gfp); >>>+ if (!new) >>>+ return NULL; >>>+ >>>+ memcpy(new, ct->ext, ct->ext->len); >> >>And maybe krealloc here? > > > krealloc() is possible to free old area before t->move(). > That breaks list used by NAT. You're right, thanks.