From patchwork Tue Dec 31 17:33:57 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Engelmayer X-Patchwork-Id: 3422481 Return-Path: X-Original-To: patchwork-linux-wireless@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 565649F295 for ; Tue, 31 Dec 2013 17:34:11 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 491C120120 for ; Tue, 31 Dec 2013 17:34:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 4FFE22011E for ; Tue, 31 Dec 2013 17:34:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753977Ab3LaReA (ORCPT ); Tue, 31 Dec 2013 12:34:00 -0500 Received: from mout.gmx.net ([212.227.15.18]:49961 "EHLO mout.gmx.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753915Ab3LaReA (ORCPT ); Tue, 31 Dec 2013 12:34:00 -0500 Received: from spike ([81.217.122.98]) by mail.gmx.com (mrgmx102) with ESMTPSA (Nemesis) id 0M2FhY-1V8Z6o2DRM-00s79L for ; Tue, 31 Dec 2013 18:33:58 +0100 Date: Tue, 31 Dec 2013 18:33:57 +0100 From: Christian Engelmayer To: Solomon Peachy Cc: linux-wireless@vger.kernel.org Subject: [PATCH] wireless: cw1200: Fix memory leak in cw1200_wow_suspend() Message-ID: <20131231183357.3664e978@spike> X-Mailer: Claws Mail 3.8.1 (GTK+ 2.24.20; x86_64-pc-linux-gnu) Mime-Version: 1.0 X-Provags-ID: V03:K0:Gd0tjrNLsD0/u5raIXTGdqbFiOSs8iKDNBxxUJeO3Q8aFBp2pCr i9omcLzmYNRDnrA10aJ9BLGOnNuefl8H+yw51i+E3a75Fu2zod6wknuS9KTf8rNk3ggAZNK 6E1zOCbeDnAvinPHn7zfb465xv+qwmJKcAudTM9yC/2STC6oqjktQOEjxR4mlgnJjNkekj5 K3iyoOqt0tHktNG18SNiA== Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Spam-Status: No, score=-7.0 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Fix a memory leak in the cw1200_wow_suspend() error handling path. Signed-off-by: Christian Engelmayer --- drivers/net/wireless/cw1200/pm.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/net/wireless/cw1200/pm.c b/drivers/net/wireless/cw1200/pm.c index b37abb9..6907c8f 100644 --- a/drivers/net/wireless/cw1200/pm.c +++ b/drivers/net/wireless/cw1200/pm.c @@ -225,7 +225,7 @@ int cw1200_wow_suspend(struct ieee80211_hw *hw, struct cfg80211_wowlan *wowlan) cw1200_set_pm(priv, &priv->powersave_mode); if (wait_event_interruptible_timeout(priv->ps_mode_switch_done, !priv->ps_mode_switch_in_progress, 1*HZ) <= 0) { - goto revert3; + goto revert4; } } @@ -254,11 +254,11 @@ int cw1200_wow_suspend(struct ieee80211_hw *hw, struct cfg80211_wowlan *wowlan) /* Stop serving thread */ if (cw1200_bh_suspend(priv)) - goto revert4; + goto revert5; ret = timer_pending(&priv->mcast_timeout); if (ret) - goto revert5; + goto revert6; /* Store suspend state */ pm_state->suspend_state = state; @@ -280,9 +280,9 @@ int cw1200_wow_suspend(struct ieee80211_hw *hw, struct cfg80211_wowlan *wowlan) return 0; -revert5: +revert6: WARN_ON(cw1200_bh_resume(priv)); -revert4: +revert5: cw1200_resume_work(priv, &priv->bss_loss_work, state->bss_loss_tmo); cw1200_resume_work(priv, &priv->join_timeout, @@ -291,6 +291,7 @@ revert4: state->direct_probe); cw1200_resume_work(priv, &priv->link_id_gc_work, state->link_id_gc); +revert4: kfree(state); revert3: wsm_set_udp_port_filter(priv, &cw1200_udp_port_filter_off);