From patchwork Thu Apr 10 18:37:53 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Engelmayer X-Patchwork-Id: 3964181 Return-Path: X-Original-To: patchwork-linux-wireless@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 15495BFF02 for ; Thu, 10 Apr 2014 18:38:47 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 830D72080B for ; Thu, 10 Apr 2014 18:38:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B994420808 for ; Thu, 10 Apr 2014 18:38:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1030404AbaDJSiQ (ORCPT ); Thu, 10 Apr 2014 14:38:16 -0400 Received: from mout.gmx.net ([212.227.17.21]:61585 "EHLO mout.gmx.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965159AbaDJSiP (ORCPT ); Thu, 10 Apr 2014 14:38:15 -0400 Received: from spike ([81.217.122.98]) by mail.gmx.com (mrgmx102) with ESMTPSA (Nemesis) id 0M3d9B-1WpzEd0p3x-00rEbB; Thu, 10 Apr 2014 20:37:58 +0200 Date: Thu, 10 Apr 2014 20:37:53 +0200 From: Christian Engelmayer To: linville@tuxdriver.com, fariyaf@gmail.com Cc: dan.carpenter@oracle.com, joe@perches.com, linux-wireless@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH resend] rsi: Fix a potential memory leak in rsi_send_auto_rate_request() Message-ID: <20140410203753.4406f4f1@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:RdGSbjM6kES2Rp8NRYdTMPZ3UqN5gS1Em/GRY/gYkBHnd6l8Dcq ngJRqfrcaCadangDQiuFSIhp+CEtpZPi6x9930VqhEryDoc1Xxkqqq2sQeNDaS5o1B9ABjU bWOWLddd3xDPqugGGAzdv6rlGiTcJ3cprzlH9VUpjpjni5ZyoTSE2Tk6OQTjLuxC+rP46yH cMpkPBsizb6czm/FNokag== 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.5 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,T_TVD_MIME_EPI,UNPARSEABLE_RELAY autolearn=unavailable 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 potential memory leak in the error path of function rsi_send_auto_rate_request(). In case memory allocation for array 'selected_rates' fails, the error path exits and leaves the previously allocated skb in place. Detected by Coverity: CID 1195575. Signed-off-by: Christian Engelmayer --- Applies against git.kernel.org/pub/scm/linux/kernel/git/linville/wireless.git Compile tested. --- drivers/net/wireless/rsi/rsi_91x_mgmt.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/wireless/rsi/rsi_91x_mgmt.c b/drivers/net/wireless/rsi/rsi_91x_mgmt.c index 2361a68..dd7946d 100644 --- a/drivers/net/wireless/rsi/rsi_91x_mgmt.c +++ b/drivers/net/wireless/rsi/rsi_91x_mgmt.c @@ -966,6 +966,7 @@ static int rsi_send_auto_rate_request(struct rsi_common *common) if (!selected_rates) { rsi_dbg(ERR_ZONE, "%s: Failed in allocation of mem\n", __func__); + dev_kfree_skb(skb); return -ENOMEM; }