From patchwork Wed May 28 09:57:09 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michal Kazior X-Patchwork-Id: 353318 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from maxx.maxx.shmoo.com (maxx.shmoo.com [205.134.188.171]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 9D21E14009A for ; Wed, 28 May 2014 20:05:23 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id 148E39CEB9; Wed, 28 May 2014 06:05:16 -0400 (EDT) X-Virus-Scanned: amavisd-new at maxx.shmoo.com Received: from maxx.maxx.shmoo.com ([127.0.0.1]) by localhost (maxx.shmoo.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id o4Qgt+nCkr+J; Wed, 28 May 2014 06:05:15 -0400 (EDT) Received: from maxx.shmoo.com (localhost [127.0.0.1]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id 163729C1FB; Wed, 28 May 2014 06:04:50 -0400 (EDT) X-Original-To: mailman-post+hostap@maxx.shmoo.com Delivered-To: mailman-post+hostap@maxx.shmoo.com Received: from localhost (localhost [127.0.0.1]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id B0A7E9C1F7 for ; Wed, 28 May 2014 06:04:47 -0400 (EDT) X-Virus-Scanned: amavisd-new at maxx.shmoo.com Received: from maxx.maxx.shmoo.com ([127.0.0.1]) by localhost (maxx.shmoo.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id ZYTon4mFUgcR for ; Wed, 28 May 2014 06:04:42 -0400 (EDT) Received: from mail-wg0-f51.google.com (mail-wg0-f51.google.com [74.125.82.51]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (not verified)) by maxx.maxx.shmoo.com (Postfix) with ESMTPS id CF97A9C1CD for ; Wed, 28 May 2014 06:04:41 -0400 (EDT) Received: by mail-wg0-f51.google.com with SMTP id x13so10890331wgg.10 for ; Wed, 28 May 2014 03:04:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tieto.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=jpa4NpSU+7rvn+Az9wq4S961x8g4rdQ0sUpTG/n7D7Y=; b=l2BAYCNUDRrZh6NLxccpFcrTzZ2L6h+JWodIMSAysId85sfFDIOPGFEQNXfKQYfbjn 8X09cd8pyFDLUCDN8WGzISl3P0omfwZgDdHHp2juJx1cij3e251G92UaGMcoIt0M0fHf npOIbepab1z4rj8O7Mgd3KW3ekaV01Bntyhs8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=jpa4NpSU+7rvn+Az9wq4S961x8g4rdQ0sUpTG/n7D7Y=; b=KmnGcgc8frCN2RBVN4fbtQPWvm8UimrIT15eJAjUTmSB6o3V5+Sz7l3EvYk1S1jUr4 xjoBsLIPzp/niX0SbaOusMp2MEqX9t4Uh9yGXX/REGMjdjHJW3lD8MX0Ltb8yxUhhIHV IZ/aR7ilNvdyuJjn7NdkR62jCyqWBk0eLszMOKOoPnSKIoI03fCQWMa5Q24OqLXhy31L Z6H9+So4wWODEBXBFyf7zIeGbCp3jzgeLUm9YJkPrZywffhaGth0YbTUZ8NCuiMoAeNc Fm9L1rjS0s+H+Pf95AJ6kz+QaRFhEzecJ7yGIpPYrGbgheHdRHdvVbBAX/G4kmoZLS3C dicw== X-Gm-Message-State: ALoCoQkC22RQnoL5owqffblajgTN+Xo0kYn0ca2Evv6fPena3SPHGTeDwl2ZHMSmdHR+L3ANF1OK7I/+9tUCLZxbHou7WUDI7WDjEWgr/tAQNeBzwSDxR+k= X-Received: by 10.194.92.7 with SMTP id ci7mr50802150wjb.7.1401271479782; Wed, 28 May 2014 03:04:39 -0700 (PDT) Received: from localhost.localdomain ([91.198.246.8]) by mx.google.com with ESMTPSA id ge6sm9836656wic.0.2014.05.28.03.04.38 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 28 May 2014 03:04:39 -0700 (PDT) From: Michal Kazior To: j@w1.fi Subject: [PATCH 1/4] nl80211: Fix wpa_driver_nl80211_if_add() failpath Date: Wed, 28 May 2014 11:57:09 +0200 Message-Id: <1401271032-7690-2-git-send-email-michal.kazior@tieto.com> X-Mailer: git-send-email 1.8.5.3 In-Reply-To: <1401271032-7690-1-git-send-email-michal.kazior@tieto.com> References: <1401271032-7690-1-git-send-email-michal.kazior@tieto.com> X-DomainID: tieto.com Cc: hostap@lists.shmoo.com X-BeenThere: hostap@lists.shmoo.com X-Mailman-Version: 2.1.11 Precedence: list List-Id: HostAP Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: hostap-bounces@lists.shmoo.com Errors-To: hostap-bounces@lists.shmoo.com Make sure to not remove interfaces that were not created by hostap. Signed-off-by: Michal Kazior --- src/drivers/driver_nl80211.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c index 9f7d0f5..1cb2acd 100644 --- a/src/drivers/driver_nl80211.c +++ b/src/drivers/driver_nl80211.c @@ -10107,19 +10107,22 @@ static int wpa_driver_nl80211_if_add(void *priv, enum wpa_driver_if_type type, if (linux_get_ifhwaddr(drv->global->ioctl_sock, ifname, new_addr) < 0) { - nl80211_remove_iface(drv, ifidx); + if (added) + nl80211_remove_iface(drv, ifidx); return -1; } if (nl80211_addr_in_use(drv->global, new_addr)) { wpa_printf(MSG_DEBUG, "nl80211: Allocate new address " "for P2P group interface"); if (nl80211_p2p_interface_addr(drv, new_addr) < 0) { - nl80211_remove_iface(drv, ifidx); + if (added) + nl80211_remove_iface(drv, ifidx); return -1; } if (linux_set_ifhwaddr(drv->global->ioctl_sock, ifname, new_addr) < 0) { - nl80211_remove_iface(drv, ifidx); + if (added) + nl80211_remove_iface(drv, ifidx); return -1; } } @@ -10148,7 +10151,8 @@ static int wpa_driver_nl80211_if_add(void *priv, enum wpa_driver_if_type type, if (linux_set_iface_flags(drv->global->ioctl_sock, ifname, 1)) { - nl80211_remove_iface(drv, ifidx); + if (added) + nl80211_remove_iface(drv, ifidx); os_free(new_bss); return -1; }