From patchwork Sat Feb 4 00:46:02 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Chinchilla, Angie V" X-Patchwork-Id: 139502 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 DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "maxx.shmoo.com", Issuer "CA Cert Signing Authority" (not verified)) by ozlabs.org (Postfix) with ESMTPS id AB4EF104792 for ; Sat, 4 Feb 2012 11:48:24 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id C252717C042; Fri, 3 Feb 2012 19:48:20 -0500 (EST) 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 UO5JiRlF6iu3; Fri, 3 Feb 2012 19:48:20 -0500 (EST) Received: from maxx.shmoo.com (localhost [127.0.0.1]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id 55C8F17C043; Fri, 3 Feb 2012 19:48:09 -0500 (EST) 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 E841717C041 for ; Fri, 3 Feb 2012 19:48:07 -0500 (EST) 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 DYkDWiMx-LP1 for ; Fri, 3 Feb 2012 19:48:03 -0500 (EST) Received: from mga03.intel.com (mga03.intel.com [143.182.124.21]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id 0405217C036 for ; Fri, 3 Feb 2012 19:48:02 -0500 (EST) Received: from azsmga002.ch.intel.com ([10.2.17.35]) by azsmga101.ch.intel.com with ESMTP; 03 Feb 2012 16:48:02 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.71,315,1320652800"; d="scan'208";a="63110918" Received: from tester-laptop-1.jf.intel.com (HELO localhost.localdomain) ([134.134.163.146]) by AZSMGA002.ch.intel.com with ESMTP; 03 Feb 2012 16:48:02 -0800 From: Angie Chinchilla To: hostap@lists.shmoo.com Subject: [PATCH] p2p: Fix the setter function for DBus group properties Date: Fri, 3 Feb 2012 16:46:02 -0800 Message-Id: <1328316362-5956-2-git-send-email-angie.v.chinchilla@intel.com> X-Mailer: git-send-email 1.7.0.4 In-Reply-To: <1328316362-5956-1-git-send-email-angie.v.chinchilla@intel.com> References: <1328316362-5956-1-git-send-email-angie.v.chinchilla@intel.com> Cc: Todd Previte X-BeenThere: hostap@lists.shmoo.com X-Mailman-Version: 2.1.9 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 From: Todd Previte The setter function uses the same hostapd_data structure as the getter which causes it to crash if called on a P2P client. To overcome this issue, the role is checked to ensure it is called on a group owner and the pointer is examined for validity. The function will return an error if called on a non-GO system. Signed-hostap: Todd Previte Signed-hostap: Angie Chinchilla --- wpa_supplicant/dbus/dbus_new_handlers_p2p.c | 10 +++++----- 1 files changed, 5 insertions(+), 5 deletions(-) diff --git a/wpa_supplicant/dbus/dbus_new_handlers_p2p.c b/wpa_supplicant/dbus/dbus_new_handlers_p2p.c index d621fb2..295b68e 100644 --- a/wpa_supplicant/dbus/dbus_new_handlers_p2p.c +++ b/wpa_supplicant/dbus/dbus_new_handlers_p2p.c @@ -1764,13 +1764,13 @@ dbus_bool_t wpas_dbus_setter_p2p_group_properties(DBusMessageIter *iter, DBusMessageIter variant_iter, iter_dict; struct wpa_dbus_dict_entry entry = { .type = DBUS_TYPE_STRING }; unsigned int i; - struct hostapd_data *hapd = wpa_s->ap_iface->bss[0]; + struct hostapd_data *hapd = NULL; - if (!hapd) { - dbus_set_error_const(error, DBUS_ERROR_FAILED, - "internal error"); + if (wpas_get_p2p_role(wpa_s) == WPAS_P2P_ROLE_GO && + wpa_s->ap_iface != NULL) + hapd = wpa_s->ap_iface->bss[0]; + else return FALSE; - } dbus_message_iter_recurse(iter, &variant_iter); if (!wpa_dbus_dict_open_read(&variant_iter, &iter_dict, error))