From patchwork Wed Aug 24 11:31:39 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Carpenter X-Patchwork-Id: 1092082 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter2.kernel.org (8.14.4/8.14.4) with ESMTP id p7OBY1Xs011732 for ; Wed, 24 Aug 2011 11:34:02 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752544Ab1HXLd6 (ORCPT ); Wed, 24 Aug 2011 07:33:58 -0400 Received: from mail-wy0-f174.google.com ([74.125.82.174]:48364 "EHLO mail-wy0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751395Ab1HXLd4 (ORCPT ); Wed, 24 Aug 2011 07:33:56 -0400 Received: by wyg24 with SMTP id 24so755530wyg.19 for ; Wed, 24 Aug 2011 04:33:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=date:from:to:cc:subject:message-id:mime-version:content-type :content-disposition:user-agent; bh=FDoQ8znTdWPRYTWho3gnHCm4NYTrNdrsOcfUMgkH5mE=; b=lpX5P3m0fv5UD1sMdcNZX/aexvlJ/Df6KTGFn8oBuDvtSmJTMnkdZ0uhy08JI/qlwl X/irA8HJE7wyiwpQe5avDKed3oUCHvd8ozuOKVz9DGd9xuyo2tNx4N2ZCGZxeVVJ0P7T X3jqUeNaoOlE5Qloq7vw612HI6sgD/AS/rzVw= Received: by 10.227.38.9 with SMTP id z9mr146647wbd.70.1314185635399; Wed, 24 Aug 2011 04:33:55 -0700 (PDT) Received: from shale.localdomain ([212.49.88.34]) by mx.google.com with ESMTPS id et16sm764763wbb.19.2011.08.24.04.33.50 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 24 Aug 2011 04:33:54 -0700 (PDT) Date: Wed, 24 Aug 2011 14:31:39 +0300 From: Dan Carpenter To: Luciano Coelho , Shahar Levi Cc: "John W. Linville" , "open list:WL1271 WIRELESS D..." , kernel-janitors@vger.kernel.org Subject: [patch -next] wl12xx: fix recent change to wl1271_tm_cmd_nvs_push() Message-ID: <20110824113139.GE5975@shale.localdomain> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter2.kernel.org [140.211.167.43]); Wed, 24 Aug 2011 11:34:02 +0000 (UTC) bc765bf3b9a "wl12xx: 1281/1283 support - Loading FW & NVS" had two problems. The condition was written so that it failed if "len" was not equal to sizeof(struct wl1271_nvs_file). Also we need to release the locks on these new error paths. Signed-off-by: Dan Carpenter --- To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/net/wireless/wl12xx/testmode.c b/drivers/net/wireless/wl12xx/testmode.c index 88add68..10c1762 100644 --- a/drivers/net/wireless/wl12xx/testmode.c +++ b/drivers/net/wireless/wl12xx/testmode.c @@ -208,11 +208,17 @@ static int wl1271_tm_cmd_nvs_push(struct wl1271 *wl, struct nlattr *tb[]) kfree(wl->nvs); - if ((wl->chip.id == CHIP_ID_1283_PG20) && - (len != sizeof(struct wl128x_nvs_file))) - return -EINVAL; - else if (len != sizeof(struct wl1271_nvs_file)) - return -EINVAL; + if (wl->chip.id == CHIP_ID_1283_PG20) { + if (len != sizeof(struct wl128x_nvs_file)) { + ret = -EINVAL; + goto out; + } + } else { + if (len != sizeof(struct wl1271_nvs_file)) { + ret = -EINVAL; + goto out; + } + } wl->nvs = kzalloc(len, GFP_KERNEL); if (!wl->nvs) {