From patchwork Sat Apr 19 16:32:37 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gang ZHAO X-Patchwork-Id: 4020201 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 9FE78BFF02 for ; Sat, 19 Apr 2014 16:34:01 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id D32E5201DC for ; Sat, 19 Apr 2014 16:34:00 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 105B5201D5 for ; Sat, 19 Apr 2014 16:34:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754574AbaDSQd6 (ORCPT ); Sat, 19 Apr 2014 12:33:58 -0400 Received: from mail-pa0-f54.google.com ([209.85.220.54]:36814 "EHLO mail-pa0-f54.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752448AbaDSQd5 (ORCPT ); Sat, 19 Apr 2014 12:33:57 -0400 Received: by mail-pa0-f54.google.com with SMTP id lf10so2386902pab.13 for ; Sat, 19 Apr 2014 09:33:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=TlreQIo6eFje2BGzF04Tb3PLbLGwKcML3PQM03A81wQ=; b=FXYmCXQtOcGI0KxfFEQAzKZWLQGWiGMTP4ftKcXcnzV1y0qjxF8cseMCCkXZBV9XtJ 8eO3WHOMl90n4WKUmhJoCaPFta3eoFiZATznnl+iDaqgxPKvKEGsdT6b7Sb4Ck37LM3i Gd3EhjFFP/QqiPfRL8g7UZczLTC+EfHvd5SU0+OE1wXqUOCQVKvv6yNLjT7+dCujfxUp m2s73L7SA3UyE4H9Ls0gcNA/pPVNlKE7k24GDLe0DAqV6JppkBNW2oP/hBpREJemrHUb IqcTjXW2U3tEclm+ETrukpa0wM25poijsxmb/sHEh2rRQMpD2hq4QsBjnWaX+n1MTx7L grmA== X-Received: by 10.68.237.133 with SMTP id vc5mr28537382pbc.92.1397925236564; Sat, 19 Apr 2014 09:33:56 -0700 (PDT) Received: from localhost.localdomain ([175.153.40.107]) by mx.google.com with ESMTPSA id e6sm67112715pbg.4.2014.04.19.09.33.52 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 19 Apr 2014 09:33:55 -0700 (PDT) From: "Zhao, Gang" To: Cc: Johannes Berg Subject: [PATCH 1/3] cfg80211: fix incorrect checking of return value Date: Sun, 20 Apr 2014 00:32:37 +0800 Message-Id: <338500f76d74ed1a62249f719024e8bbc5120790.1397924746.git.gamerh2o@gmail.com> X-Mailer: git-send-email 1.9.0 In-Reply-To: References: In-Reply-To: References: 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.4 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham 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 Since cfg80211_chandef_dfs_required() can return error number(e.g., -EINVAL), it's not sufficient to just check if it didn't return zero. Fixes: 9e0e29615a20 ("cfg80211: consider existing DFS interfaces") Signed-off-by: Zhao, Gang --- net/wireless/chan.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/net/wireless/chan.c b/net/wireless/chan.c index 9c9501a..2cfff9e 100644 --- a/net/wireless/chan.c +++ b/net/wireless/chan.c @@ -744,7 +744,7 @@ cfg80211_get_chan_state(struct wireless_dev *wdev, *chanmode = CHAN_MODE_SHARED; if (cfg80211_chandef_dfs_required(wdev->wiphy, - &wdev->chandef)) + &wdev->chandef) > 0) *radar_detect |= BIT(wdev->chandef.width); } return; @@ -754,7 +754,7 @@ cfg80211_get_chan_state(struct wireless_dev *wdev, *chanmode = CHAN_MODE_SHARED; if (cfg80211_chandef_dfs_required(wdev->wiphy, - &wdev->chandef)) + &wdev->chandef) > 0) *radar_detect |= BIT(wdev->chandef.width); } return;