Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S936304Ab3DJUJB (ORCPT ); Wed, 10 Apr 2013 16:09:01 -0400 Received: from mx4-phx2.redhat.com ([209.132.183.25]:59710 "EHLO mx4-phx2.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S935970Ab3DJUJA (ORCPT ); Wed, 10 Apr 2013 16:09:00 -0400 Date: Wed, 10 Apr 2013 16:08:55 -0400 (EDT) From: Eric Paris To: Chen Gang Cc: Al Viro , linux-kernel@vger.kernel.org Message-ID: <407910335.12018469.1365624535873.JavaMail.root@redhat.com> In-Reply-To: <51653645.90401@asianux.com> References: <51653645.90401@asianux.com> Subject: Re: [PATCH] kernel: auditfilter: looping issue, memory leak if has 2 or more AUDIT_FILTERKEYs MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Originating-IP: [10.5.82.12] X-Mailer: Zimbra 8.0.3_GA_5664 (ZimbraWebClient - FF20 (Linux)/8.0.3_GA_5664) Thread-Topic: kernel: auditfilter: looping issue, memory leak if has 2 or more AUDIT_FILTERKEYs Thread-Index: 3BeKkYef8KpORrjPWhkIucUSbQEZfg== Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1175 Lines: 37 We only allow one filter key per rule. So we should never be able to get into this situation. See audit_data_to_entry() -Eric ----- Original Message ----- > > in the 'fcount' looping, > if 'new->fields[*].type" has 2 or more AUDIT_FILTERKEYs > need judge new->filterkey whether has value, or memory leak. > > Signed-off-by: Chen Gang > --- > kernel/auditfilter.c | 2 ++ > 1 files changed, 2 insertions(+), 0 deletions(-) > > diff --git a/kernel/auditfilter.c b/kernel/auditfilter.c > index f9fc54b..936ac79 100644 > --- a/kernel/auditfilter.c > +++ b/kernel/auditfilter.c > @@ -859,6 +859,8 @@ struct audit_entry *audit_dupe_rule(struct audit_krule > *old) > &old->fields[i]); > break; > case AUDIT_FILTERKEY: > + if (new->filterkey) > + break; > fk = kstrdup(old->filterkey, GFP_KERNEL); > if (unlikely(!fk)) > err = -ENOMEM; > -- > 1.7.7.6 > -- 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/