From patchwork Wed Dec 23 13:29:37 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Carpenter X-Patchwork-Id: 69547 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.2) with ESMTP id nBNDU6oX028360 for ; Wed, 23 Dec 2009 13:30:06 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755937AbZLWN37 (ORCPT ); Wed, 23 Dec 2009 08:29:59 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1755928AbZLWN37 (ORCPT ); Wed, 23 Dec 2009 08:29:59 -0500 Received: from mail-yx0-f187.google.com ([209.85.210.187]:43624 "EHLO mail-yx0-f187.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753954AbZLWN36 (ORCPT ); Wed, 23 Dec 2009 08:29:58 -0500 Received: by yxe17 with SMTP id 17so6749283yxe.33 for ; Wed, 23 Dec 2009 05:29:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:date:from:to:cc:subject :message-id:mime-version:content-type:content-disposition:user-agent; bh=XEvP6lqfPFn9gA7HR3VPlTFOVVRiHsSVl4bRc2oT0Jk=; b=kemEiA+l6LpOAa0z5WSDamBJtq4kZs49HBY6fCgw2Ei3n/QBcisYANv4iLRU/AFPjz 5vXXYhpFxU08dbGlwMQfJ47YTkxknfPkS+14tvt0KTOayI4tldq4yoEtUiUztPkuV+P1 fkx78MYlZ7pEclU5nxw5Wz+8u2lZozlAPapBg= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=date:from:to:cc:subject:message-id:mime-version:content-type :content-disposition:user-agent; b=bZK6lPa5soXW1dwZ8vlfySsHxuocQAu0A0QQMogmlaY/KRiQ7+/Rd2WUEMDIfz2LkN NCUIpdUlbLxzq3kfIxCDlPWzWmnvcNvuUwD4FrAjTNb7GgrtxaWu8W+WGzjwt01xw7oR M6mIUpHvb9EWOBqUmyxy/3md/Gkuz4V7lHkh0= Received: by 10.151.88.21 with SMTP id q21mr15323064ybl.303.1261574997603; Wed, 23 Dec 2009 05:29:57 -0800 (PST) Received: from bicker ([41.216.229.67]) by mx.google.com with ESMTPS id 22sm6378267iwn.12.2009.12.23.05.29.50 (version=TLSv1/SSLv3 cipher=RC4-MD5); Wed, 23 Dec 2009 05:29:57 -0800 (PST) Date: Wed, 23 Dec 2009 15:29:37 +0200 From: Dan Carpenter To: Johannes Berg Cc: "John W. Linville" , "David S. Miller" , linux-wireless@vger.kernel.org, netdev@vger.kernel.org Subject: [patch] fix error paths in cfg80211_wext_siwscan() Message-ID: <20091223132937.GG17923@bicker> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.18 (2008-05-17) Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org --- orig/net/wireless/scan.c 2009-12-23 08:38:15.000000000 +0200 +++ devel/net/wireless/scan.c 2009-12-23 08:50:15.000000000 +0200 @@ -685,7 +685,7 @@ int cfg80211_wext_siwscan(struct net_dev /* No channels found? */ if (!i) { err = -EINVAL; - goto out; + goto out1; } /* Set real number of channels specified in creq->channels[] */ @@ -694,8 +694,10 @@ int cfg80211_wext_siwscan(struct net_dev /* translate "Scan for SSID" request */ if (wreq) { if (wrqu->data.flags & IW_SCAN_THIS_ESSID) { - if (wreq->essid_len > IEEE80211_MAX_SSID_LEN) - return -EINVAL; + if (wreq->essid_len > IEEE80211_MAX_SSID_LEN) { + err = -EINVAL; + goto out1; + } memcpy(creq->ssids[0].ssid, wreq->essid, wreq->essid_len); creq->ssids[0].ssid_len = wreq->essid_len; } @@ -705,6 +707,7 @@ int cfg80211_wext_siwscan(struct net_dev rdev->scan_req = creq; err = rdev->ops->scan(wiphy, dev, creq); +out1: if (err) { rdev->scan_req = NULL; kfree(creq);