From patchwork Sun Oct 31 08:06:35 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Graf X-Patchwork-Id: 69700 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 65BD21007D2 for ; Sun, 31 Oct 2010 19:06:48 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754015Ab0JaIGl (ORCPT ); Sun, 31 Oct 2010 04:06:41 -0400 Received: from canuck.infradead.org ([134.117.69.58]:54164 "EHLO canuck.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753252Ab0JaIGg (ORCPT ); Sun, 31 Oct 2010 04:06:36 -0400 Received: from tgr by canuck.infradead.org with local (Exim 4.72 #1 (Red Hat Linux)) id 1PCSvz-0002Co-JZ; Sun, 31 Oct 2010 08:06:35 +0000 Date: Sun, 31 Oct 2010 04:06:35 -0400 From: Thomas Graf To: davem@davemloft.net Cc: netdev@vger.kernel.org Subject: [PATCH] text ematch: check for NULL pointer before destroying textsearch config Message-ID: <20101031080635.GA22639@canuck.infradead.org> Mail-Followup-To: davem@davemloft.net, netdev@vger.kernel.org MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.20 (2009-08-17) X-SRS-Rewrite: SMTP reverse-path rewritten from by canuck.infradead.org See http://www.infradead.org/rpr.html Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org While validating the configuration em_ops is already set, thus the individual destroy functions are called, but the ematch data has not been allocated and associated with the ematch yet. Signed-off-by: Thomas Graf --- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Index: net-2.6/net/sched/em_text.c =================================================================== --- net-2.6.orig/net/sched/em_text.c +++ net-2.6/net/sched/em_text.c @@ -103,7 +103,8 @@ retry: static void em_text_destroy(struct tcf_proto *tp, struct tcf_ematch *m) { - textsearch_destroy(EM_TEXT_PRIV(m)->config); + if (EM_TEXT_PRIV(m) && EM_TEXT_PRIV(m)->config) + textsearch_destroy(EM_TEXT_PRIV(m)->config); } static int em_text_dump(struct sk_buff *skb, struct tcf_ematch *m)