Received: by 2002:a05:7412:2a8c:b0:e2:908c:2ebd with SMTP id u12csp578396rdh; Sun, 24 Sep 2023 03:01:15 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFHJJV2e+br6yhNHu/ETUqajhzO1OwMXU5FLkIlcu+A9q+cJzBYfNhx1gObZhS0rQGa+Amt X-Received: by 2002:a17:903:11cd:b0:1b8:6a09:9cf9 with SMTP id q13-20020a17090311cd00b001b86a099cf9mr4967718plh.26.1695549675021; Sun, 24 Sep 2023 03:01:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695549675; cv=none; d=google.com; s=arc-20160816; b=Df6uJfxsf6QFBi3PrG0EIz8dHkN2Mmi9OoQ6jU2M5bqsWzYbqon4T5MV0LIj+sQpab 1kPHRC0klWoMDegRaFWM2S1DkxrOqZwwOhp/rZQDshYr+WCpb5OEkR8hr68/MSHT8nzX 7fb4RGDLX+hHlH72TsowPWj8zVTPYUJGNOHZqMOpg/3NTm02Le+f/sARCmIuM4Skm8i8 bDbbz8EDYVs1sfJh/FIoEEUbxhgt3dz3JSaMi5gLhCidKUcBXreL+9QGsgQGkAECYSsZ o6OSWXB2vC32IrZ4nzz6tylJauBf6eX8TB/uoIIcT8+h8/7tIglWYXcim5runbOYAYPn /98A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=iGzNAoRtFRkqcxCkNp3FPfcx3BcBPyiwFBXbBlaScV0=; fh=NCD871LpmFEzf0QX0OXyG2oQ2shZjfyV18aQxLUJdfw=; b=URFa+QJBfq0lZ4Tc9JUaXswbCNyAeiPoyog9W+2VyNmffmjumgyg8gAIEXG0/xUUvg HJlcQz9iVzXzOUqyiTyQWw/Ma8U2O04DPzyvDlaLOdUlS/fi1/GUHiTRYwV79JT4bODp kbQXQXLLMDyZ/iNRR12RrJW74Czbhhy8KtDPdacXiDdl8I9tgllVcfyDDMh6HHgROKBh 6+wcfxURAub5FkTYknPzdOcwaQ+sDAWMHZZfyXwHT7wzRRy4VzNwNI7rk4M9nP4yvN6x 2ho8dQeVsI6Mr1hYMyXktmsN7/GmZ7uilfrGb5JSq/dLwr620G4FCh13FKj7VhTQNpK1 Qnrw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@wanadoo.fr header.s=t20230301 header.b="V0YCvZ/4"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=wanadoo.fr Return-Path: Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id kf15-20020a17090305cf00b001b9fb999147si7035623plb.89.2023.09.24.03.01.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 24 Sep 2023 03:01:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@wanadoo.fr header.s=t20230301 header.b="V0YCvZ/4"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=wanadoo.fr Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id CC6168027670; Sat, 23 Sep 2023 23:58:12 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229928AbjIXG6H (ORCPT + 99 others); Sun, 24 Sep 2023 02:58:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54708 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229699AbjIXG6E (ORCPT ); Sun, 24 Sep 2023 02:58:04 -0400 Received: from smtp.smtpout.orange.fr (smtp-18.smtpout.orange.fr [80.12.242.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2C40610B for ; Sat, 23 Sep 2023 23:57:56 -0700 (PDT) Received: from pop-os.home ([86.243.2.178]) by smtp.orange.fr with ESMTPA id kJ3wqxINJLxWbkJ3wqOyHA; Sun, 24 Sep 2023 08:57:54 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wanadoo.fr; s=t20230301; t=1695538674; bh=iGzNAoRtFRkqcxCkNp3FPfcx3BcBPyiwFBXbBlaScV0=; h=From:To:Cc:Subject:Date; b=V0YCvZ/4caGOUQtjOU3zWtUT88aXF7bmdwDxpABBjf4ve4CqKUlQ6Yc7U5SMm605b OWvAUZCTR38E+8gZfqXbtA/4TvjqLgJF+79sjdQkLWnwjt5GK4pNVSkI7xx5l2oy5p bj3nt36Oaxt6AYlfbOSV8/HPT0V1H9CuBVo8E+QnuKmwQdq1X/kgbT8vQu80vQH8h7 hjlL5CZoKQGpQQFZP2sUszk2t36T+UGpHjNKWWMma6AZeQWr88lWf+kJOEhvYa8uex X6VePt6pTff6/pC9IVrm9TxvRStQV6ldj4rb+gDZXcH4bmiGtc44RzLdrIlFb+cPSt xxo4w/8Ie3Viw== X-ME-Helo: pop-os.home X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Sun, 24 Sep 2023 08:57:54 +0200 X-ME-IP: 86.243.2.178 From: Christophe JAILLET To: Kalle Valo , Christophe JAILLET Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Kalle Valo , linux-wireless@vger.kernel.org Subject: [PATCH wireless 1/2] ath: dfs_pattern_detector: Fix a memory initialization issue Date: Sun, 24 Sep 2023 08:57:49 +0200 Message-Id: X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Sat, 23 Sep 2023 23:58:13 -0700 (PDT) If an error occurs and channel_detector_exit() is called, it relies on entries of the 'detectors' array to be NULL. Otherwise, it may access to un-initialized memory. Fix it and initialize the memory, as what was done before the commit in Fixes. Fixes: a063b650ce5d ("ath: dfs_pattern_detector: Avoid open coded arithmetic in memory allocation") Signed-off-by: Christophe JAILLET --- Patch #1/2 is a fix, for for wireless. Patch #2/2 is for wireless-next I guess, but depnds on #1 Not sure if we can mix different target in the same serie. Let me know. BTW, sorry for messing up things with a063b650ce5d :( --- drivers/net/wireless/ath/dfs_pattern_detector.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/wireless/ath/dfs_pattern_detector.c b/drivers/net/wireless/ath/dfs_pattern_detector.c index 27f4d74a41c8..2788a1b06c17 100644 --- a/drivers/net/wireless/ath/dfs_pattern_detector.c +++ b/drivers/net/wireless/ath/dfs_pattern_detector.c @@ -206,7 +206,7 @@ channel_detector_create(struct dfs_pattern_detector *dpd, u16 freq) INIT_LIST_HEAD(&cd->head); cd->freq = freq; - cd->detectors = kmalloc_array(dpd->num_radar_types, + cd->detectors = kcalloc(dpd->num_radar_types, sizeof(*cd->detectors), GFP_ATOMIC); if (cd->detectors == NULL) goto fail; -- 2.34.1