From patchwork Fri Oct 2 21:37:05 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Baptiste Jonglez X-Patchwork-Id: 1376096 X-Patchwork-Delegate: hauke@hauke-m.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.openwrt.org (client-ip=2001:8b0:10b:1231::1; helo=merlin.infradead.org; envelope-from=openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=bitsofnetworks.org Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=merlin.20170209 header.b=gR7CQvEF; dkim-atps=neutral Received: from merlin.infradead.org (merlin.infradead.org [IPv6:2001:8b0:10b:1231::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4C33Ky18GSz9sS8 for ; Sat, 3 Oct 2020 07:39:33 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:To:From: Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender :Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=OSQCxs/Hf/meBLwSuruTMqBTGvRqQWOJBzEmzwQHju4=; b=gR7CQvEFFwr+Jf2WUcieDakAIv 7WzPylZPYexMyl9+KFCz0rmRAr9YccwGBiVbdQTe7bX0PqhCnY7uKbyZvTD43y/D8IFhKwZTo/2Sy j6+91wOxWWQhxhxfJ8s/savYzdJkW95Mb8EAWpGnzmxTEhHWi9XtVyH3OC8MyCfQzV3Wv5PO099Zg zkfwpjq+Qc6vvxdgqpINnmHQXalTfDfUemWTuEGl7zAhMExhVkvjlLiJAv11aUV7Sr3gmM45Tj9La hkFPyTkfS8HZsd0vt/4bsms9L/tkjEKbFVhJFpNMvFKJQJWL8UB3+iiTXLf/mEdagWcwJORs8OzGC pgPXvujQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kOSk3-0003O7-QO; Fri, 02 Oct 2020 21:37:27 +0000 Received: from mails.bitsofnetworks.org ([2001:912:1800:ff::131]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kOSk1-0003N9-1n for openwrt-devel@lists.openwrt.org; Fri, 02 Oct 2020 21:37:26 +0000 Received: from [2001:912:1800::5c8] (helo=localhost.localdomain) by mails.bitsofnetworks.org with esmtp (Exim 4.89) (envelope-from ) id 1kOSjp-00050G-Ru; Fri, 02 Oct 2020 23:37:13 +0200 From: Baptiste Jonglez To: openwrt-devel@lists.openwrt.org Subject: [PATCH 18.06] ar71xx: mikrotik: bypass id check in __rb_get_wlan_data() Date: Fri, 2 Oct 2020 23:37:05 +0200 Message-Id: <20201002213705.1189117-1-baptiste@bitsofnetworks.org> X-Mailer: git-send-email 2.27.0 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201002_173725_217191_82A4D983 X-CRM114-Status: GOOD ( 14.11 ) X-Spam-Score: 0.0 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (0.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: OpenWrt Development List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?Thibaut_VAR=C3=88NE?= , Baptiste Jonglez Sender: "openwrt-devel" Errors-To: openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org From: Thibaut VARÈNE The id parameter in __rb_get_wlan_data() was incorrectly used on the assumption that id "0" would always be tied to ath9k with RLE encoding and positive id (in fact, only id "1" was valid) would always be tied to ("external") ath10k with LZO encoding. Newer hardware revisions of supported devices prove this assumption to be invalid, with ath9k caldata being now wrapped in MAGIC_ERD and LZO compressed, so disable this check to allow newer hardware to correctly decode caldata for ath9k. Note: this patch assumes that ath9k caldata is never stored with the new "LZOR" encoding scheme found on some ath10k devices. Signed-off-by: Thibaut VARÈNE (cherry picked from commit 1c6990fe6d198718850b6a37998416cac69f6f53) [keep publishing ath10k caldata in sysfs: it's the way it's done on 18.06] Signed-off-by: Baptiste Jonglez Tested-by: Baptiste Jonglez [Mikrotik RB941-2nD r3] --- target/linux/ar71xx/files/arch/mips/ath79/routerboot.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/target/linux/ar71xx/files/arch/mips/ath79/routerboot.c b/target/linux/ar71xx/files/arch/mips/ath79/routerboot.c index 76776e1d84..945894f823 100644 --- a/target/linux/ar71xx/files/arch/mips/ath79/routerboot.c +++ b/target/linux/ar71xx/files/arch/mips/ath79/routerboot.c @@ -206,10 +206,7 @@ __rb_get_wlan_data(u16 id) u8 *erd_data; u16 erd_len; - if (id == 0) - goto err_free; - - err = routerboot_find_tag(tag, tag_len, id, + err = routerboot_find_tag(tag, tag_len, 0x1, &erd_data, &erd_len); if (err) { pr_err("no ERD data found for id %u\n", id); @@ -224,9 +221,6 @@ __rb_get_wlan_data(u16 id) goto err_free; } } else { - if (id != 0) - goto err_free; - err = rle_decode((char *) tag, tag_len, buf, RB_ART_SIZE, &src_done, &dst_done); if (err) {