Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp2576464rdg; Mon, 16 Oct 2023 08:26:50 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEMqQSY4ozesEiPMMtYOGD/Pefb/M7P9iEA4g1wVezf+czR/UaYyFFGH4igtKtRQy673+EB X-Received: by 2002:a17:902:e812:b0:1b0:3ab6:5140 with SMTP id u18-20020a170902e81200b001b03ab65140mr11136051plg.4.1697470010486; Mon, 16 Oct 2023 08:26:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697470010; cv=none; d=google.com; s=arc-20160816; b=i6wEWAFUYY6OSBRKMJOVullyAX2C+WBPqhRFsG6Q9zueqIq/IO5+SrnnWnXjN83qPJ QtHnpPOd74fXmH9/3Lum8pKVm0Bj1AEqdDIY4qS4SMZlsf5hF/vvoZjdL/HTlb70yI+N 1at7YMuJ1kLnFKu22Wcg6y6pan2GQZhrghtefXo9jL63wvH6iE0kH1lYZ0ScHaB9+BuQ g7S3iWDJru2Yq/jylZnAoFn+XAc3dMxDehH99Cp+kjzXEFJ3yU1V/CalVTksU+LjuZKK dsSvJVe+rSyl7ftF+9iHEMhsjYaFVS0SunsEhSUBR9IDlhDnkVF0+10LPJpwD2ogTR3v s7rQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=MyC9f2w4EEsPlVpNLnlyuAWHpwQt8r4G/toQCWixs/8=; fh=7O2oE7l1tGeOwGMuA2a3p45Fr4/hR89m7WZCY+sr1uw=; b=KUijoC4zEoLSV8ANAadmPhFu6Wq996pb8uLNcziLst60Ru4DigFV0gkPDAVjAv69K+ yXhvKfz8LtW6Ez7N802SBXU3WQSm3iyJCvBYBt6NDA2pLp28o525AggV554OQFscT9y0 Ah5GBpbVoeXRQLY7vZzTJ+kjpHbOKS4SSDJG8lTUnB+i1I+7cBzObNCby3xgrSFk3SY/ qfgPViNyZ08L6rxfJ7HE+FP2UON6wfs7yNOi0jjBSVNxbvKUpzOaTRFYacz+njefZY2y Cg+FXHfWdNLpveSt8/eTPb+BTDIgeTKRAn/3whWUrfFRT9WLa/mQH+p+8hTVw/JIV/XT EbTA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=DOEboIWi; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Return-Path: Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id p11-20020a1709026b8b00b001bbb6f4cd6dsi10417758plk.334.2023.10.16.08.26.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Oct 2023 08:26:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=DOEboIWi; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 7BDFB807757D; Mon, 16 Oct 2023 08:26:46 -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 S232531AbjJPP0o (ORCPT + 52 others); Mon, 16 Oct 2023 11:26:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59634 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231569AbjJPP0n (ORCPT ); Mon, 16 Oct 2023 11:26:43 -0400 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7EA1583; Mon, 16 Oct 2023 08:26:41 -0700 (PDT) Received: from pps.filterd (m0279873.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 39GDqkYC016148; Mon, 16 Oct 2023 15:26:29 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h=message-id : date : mime-version : subject : to : cc : references : from : in-reply-to : content-type : content-transfer-encoding; s=qcppdkim1; bh=MyC9f2w4EEsPlVpNLnlyuAWHpwQt8r4G/toQCWixs/8=; b=DOEboIWieNTh9elHXLcw2qP1jt0wMIp1zsuNc7m3ISKuXV7PAi4bUUhozxzmthqewDC9 PF8VBQhgcNmaeqoewRnxiCmORDttb5eMhmidSeQ/e0SE7PwteSUr1PEFCrB2ghv+q8CQ evWMWXi3g1OCLEPu2btQfkDLwGIZS6g6q6JzRf8GZ6Q6Knz1M47DCFgri8rWTc5MhW4l 0+aRHWFSHZmkSJz/M00wEnIgnOxSPphliPBKC0K7KjPfzsTSM92ym+JgC3rWpEzt5icl ATxPKIP8acCriJwzMGgw93cewgdfutlcFnwJXSrAXd0PnxQmd11gPPzf3PsqPHNE3ssN PQ== Received: from nalasppmta05.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3tqgbt4p4j-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 16 Oct 2023 15:26:28 +0000 Received: from nalasex01a.na.qualcomm.com (nalasex01a.na.qualcomm.com [10.47.209.196]) by NALASPPMTA05.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 39GFQRsX005741 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 16 Oct 2023 15:26:27 GMT Received: from [10.48.240.22] (10.49.16.6) by nalasex01a.na.qualcomm.com (10.47.209.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.39; Mon, 16 Oct 2023 08:26:27 -0700 Message-ID: Date: Mon, 16 Oct 2023 08:26:26 -0700 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v2] wifi: wilc1000: use vmm_table as array in wilc struct Content-Language: en-US To: =?UTF-8?Q?Alexis_Lothor=C3=A9?= , Claudiu Beznea , Kalle Valo , Michael Walle CC: , , Thomas Petazzoni , Ajay Singh , References: <20231016-wilc1000_tx_oops-v2-1-8d1982a29ef1@bootlin.com> From: Jeff Johnson In-Reply-To: <20231016-wilc1000_tx_oops-v2-1-8d1982a29ef1@bootlin.com> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 8bit X-Originating-IP: [10.49.16.6] X-ClientProxiedBy: nalasex01b.na.qualcomm.com (10.47.209.197) To nalasex01a.na.qualcomm.com (10.47.209.196) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: hn3_gZv5TaIoq10NCTZuuGF58VgI8Baz X-Proofpoint-ORIG-GUID: hn3_gZv5TaIoq10NCTZuuGF58VgI8Baz X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.980,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-10-16_08,2023-10-12_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 mlxscore=0 priorityscore=1501 impostorscore=0 malwarescore=0 mlxlogscore=927 adultscore=0 spamscore=0 bulkscore=0 clxscore=1011 phishscore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2309180000 definitions=main-2310160133 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham 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-wireless@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Mon, 16 Oct 2023 08:26:46 -0700 (PDT) On 10/16/2023 1:29 AM, Alexis Lothoré wrote: > From: Ajay Singh > > Enabling KASAN and running some iperf tests raises some memory issues with > vmm_table: > > BUG: KASAN: slab-out-of-bounds in wilc_wlan_handle_txq+0x6ac/0xdb4 > Write of size 4 at addr c3a61540 by task wlan0-tx/95 > > KASAN detects that we are writing data beyond range allocated to vmm_table. > There is indeed a mismatch between the size passed to allocator in > wilc_wlan_init, and the range of possible indexes used later: allocation > size is missing a multiplication by sizeof(u32) > > Fixes: 40b717bfcefa ("wifi: wilc1000: fix DMA on stack objects") > Cc: stable@vger.kernel.org > Signed-off-by: Ajay Singh > Signed-off-by: Alexis Lothoré > --- > Changes in v2: > - keep dedicated dynamic allocation for vmm_table > - Link to v1: https://lore.kernel.org/r/20231013-wilc1000_tx_oops-v1-1-3761beb9524d@bootlin.com > --- > drivers/net/wireless/microchip/wilc1000/wlan.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/net/wireless/microchip/wilc1000/wlan.c b/drivers/net/wireless/microchip/wilc1000/wlan.c > index 58bbf50081e4..e4113f2dfadf 100644 > --- a/drivers/net/wireless/microchip/wilc1000/wlan.c > +++ b/drivers/net/wireless/microchip/wilc1000/wlan.c > @@ -1492,7 +1492,7 @@ int wilc_wlan_init(struct net_device *dev) > } > > if (!wilc->vmm_table) > - wilc->vmm_table = kzalloc(WILC_VMM_TBL_SIZE, GFP_KERNEL); > + wilc->vmm_table = kzalloc(WILC_VMM_TBL_SIZE * sizeof(u32), GFP_KERNEL); this is probably OK since the values are constant, but kcalloc() is generally preferred > > if (!wilc->vmm_table) { > ret = -ENOBUFS; > > --- > base-commit: ea12d85cbfd6b08fff40a4fefccc011b6cfadf8e > change-id: 20231012-wilc1000_tx_oops-58ce91ee3e93 > > Best regards,