Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.9 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E73C8C18E5B for ; Mon, 16 Mar 2020 22:31:16 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id BE6DA20663 for ; Mon, 16 Mar 2020 22:31:16 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=narfation.org header.i=@narfation.org header.b="ijOS3pf6" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732816AbgCPWbQ (ORCPT ); Mon, 16 Mar 2020 18:31:16 -0400 Received: from dvalin.narfation.org ([213.160.73.56]:49142 "EHLO dvalin.narfation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732766AbgCPWbQ (ORCPT ); Mon, 16 Mar 2020 18:31:16 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=narfation.org; s=20121; t=1584397874; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=PM/p7o1f3f+Xwepqa8SvU8L36fHzG1ZrktAxe5t6xQE=; b=ijOS3pf6FtojD0DqHFi8mzTSQkvquBKBDLmcemGQr4mkcau707RVFiw8L796VmHaG8u/TK qeVucxao5mx1goLsfv2HhyJ4AxzH7oHurt4P6oeUom14fiw2axQTA5liciwYZvfMbmVLCi GMeoMNI7dBojQ4syDH65NmQRHTtfBY4= From: Sven Eckelmann To: stable@vger.kernel.org Cc: Sven Eckelmann , Alvaro Antelo , Marek Lindner , Simon Wunderlich Subject: [PATCH 4.9 06/24] batman-adv: Accept only filled wifi station info Date: Mon, 16 Mar 2020 23:30:47 +0100 Message-Id: <20200316223105.6333-7-sven@narfation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200316223105.6333-1-sven@narfation.org> References: <20200316223105.6333-1-sven@narfation.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam: Yes Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org commit d62890885efbc48acea46964ea3af69b61c8c5eb upstream. The wifi driver can decide to not provide parts of the station info. For example, the expected throughput of the station can be omitted when the used rate control doesn't provide this kind of information. The B.A.T.M.A.N. V implementation must therefore check the filled bitfield before it tries to access the expected_throughput of the returned station_info. Reported-by: Alvaro Antelo Fixes: c833484e5f38 ("batman-adv: ELP - compute the metric based on the estimated throughput") Signed-off-by: Sven Eckelmann Reviewed-by: Marek Lindner Signed-off-by: Simon Wunderlich --- net/batman-adv/bat_v_elp.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/net/batman-adv/bat_v_elp.c b/net/batman-adv/bat_v_elp.c index 337cdcd3386f..3ff0dc83d04b 100644 --- a/net/batman-adv/bat_v_elp.c +++ b/net/batman-adv/bat_v_elp.c @@ -19,6 +19,7 @@ #include "main.h" #include +#include #include #include #include @@ -29,6 +30,7 @@ #include #include #include +#include #include #include #include @@ -102,6 +104,8 @@ static u32 batadv_v_elp_get_throughput(struct batadv_hardif_neigh_node *neigh) } if (ret) goto default_throughput; + if (!(sinfo.filled & BIT(NL80211_STA_INFO_EXPECTED_THROUGHPUT))) + goto default_throughput; return sinfo.expected_throughput / 100; } -- 2.20.1