Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3082604pxj; Mon, 7 Jun 2021 01:37:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy497mksirDlM6zlOpKcTQF4XL8ZfZlwwZJFpsCfWbN/X2KwqrmFzBixRAHhQnZs0+CMCw5 X-Received: by 2002:aa7:ce05:: with SMTP id d5mr18464500edv.325.1623055039383; Mon, 07 Jun 2021 01:37:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623055039; cv=none; d=google.com; s=arc-20160816; b=SOA7k61tsAN5VM6HAhlJHanVFE9KVqMnYJqb7ABzpZt+Iqxo6sk30WVaEAQE7H8TqF CrYPMQAFO647xZIh88igfnnIfYjjxVSQMMALXDwx6FjdVmZKUbzHdp4VazvcLFwUpxy+ 2jc3FP+EwsgfjMotTkisoJKcDxVpAMxc1XxS/6s0Q+6JXyYCduaMXHmv8R1fR3TYUWpm LdGOI/zbEwBINmK1QgX9flg0gJheWN2Jhv/WGuLQ7f+1iNWAWeJT4SKDK6JmMHze4gwU jOrOgjIY3+g9oOZ+G6VQIUfOC8gTs7LRNY3vph6x/3swdTCpul3uhGpoucr+DO2S/3VM Tn7Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=6ZTcKTv3Yj72FnfPMYNuvaGy/891xXLCn+KYZZpuozQ=; b=rMMy6SfDBtd9cOTT2o+hAj2PDmUyHD9MceQV20KFNHO1guOHSwKH2YZKVaqFKqSakF N4slQpAn5sRFhw8ok1ue6SJ9LSznH+NWg5PDHA60RMz2j6KEUbot2Vea0yoSQJNxCGJZ znDLDIgYloYR06OyJO+obK+O43pXUUULffIJ8Msh117jwXD3hkbN7QaAP8Yee6wprVOk ih/zEwCcC6GJts7lUKVHUQq7Z6BxUETdJtbIsmQ3CH4v761VfcroaZBHDaW7L9rpr0cL hmyqBj2RRf9EuHyI1BFS70dsNYEHT6vAAc8Lh/3qZKT9BZoGBR6P2aL1UiwLyPGkQE/y cw1Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2020-01-29 header.b="Q2Fm5/6x"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y8si10457427edd.181.2021.06.07.01.36.56; Mon, 07 Jun 2021 01:37:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2020-01-29 header.b="Q2Fm5/6x"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230191AbhFGIhr (ORCPT + 99 others); Mon, 7 Jun 2021 04:37:47 -0400 Received: from mx0a-00069f02.pphosted.com ([205.220.165.32]:16306 "EHLO mx0a-00069f02.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229545AbhFGIhr (ORCPT ); Mon, 7 Jun 2021 04:37:47 -0400 Received: from pps.filterd (m0246617.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 1578RJVp026781; Mon, 7 Jun 2021 08:35:52 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=date : from : to : cc : subject : message-id : references : mime-version : content-type : in-reply-to; s=corp-2020-01-29; bh=6ZTcKTv3Yj72FnfPMYNuvaGy/891xXLCn+KYZZpuozQ=; b=Q2Fm5/6xl/rGkF+QAyfqlsgUpiGjQc4xHBjtQEtlXwrundHzazzoHz2LU1vR/msHG3x+ yohA9mGkZG2o8eUsaAHfDHWatDm3Wo6HRv97vYrXapR962dsSW2FuRr6tXp1huzCglAG w7DZojeVd4CfIZCrzhUXKbn+g2z76COnzVlo4D4qX7755BE9t4dR4E5cs6IzAPshuWFB gWM6vbNshbsnwpiSfyEVY37tyQ2kYg9SNickKZrCj6EE+mra+4r+NEWHp2ZKxO8pl5Ks gSmEqoa6yOWZdmOXx8G9TiInN5g0KHvLSWu1PdEqgPWzTHP7BWUWz+kCZ0ovT1pg4uB6 6w== Received: from oracle.com (userp3030.oracle.com [156.151.31.80]) by mx0b-00069f02.pphosted.com with ESMTP id 3901ts8n20-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 07 Jun 2021 08:35:52 +0000 Received: from userp3030.oracle.com (userp3030.oracle.com [127.0.0.1]) by pps.podrdrct (8.16.0.36/8.16.0.36) with SMTP id 1578UmVW069313; Mon, 7 Jun 2021 08:35:51 GMT Received: from pps.reinject (localhost [127.0.0.1]) by userp3030.oracle.com with ESMTP id 38yxctphw4-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 07 Jun 2021 08:35:51 +0000 Received: from userp3030.oracle.com (userp3030.oracle.com [127.0.0.1]) by pps.reinject (8.16.0.36/8.16.0.36) with SMTP id 1578ZoxB076497; Mon, 7 Jun 2021 08:35:50 GMT Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by userp3030.oracle.com with ESMTP id 38yxctphvx-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 07 Jun 2021 08:35:50 +0000 Received: from abhmp0002.oracle.com (abhmp0002.oracle.com [141.146.116.8]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id 1578ZnoK023620; Mon, 7 Jun 2021 08:35:49 GMT Received: from kadam (/41.212.42.34) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 07 Jun 2021 08:35:48 +0000 Date: Mon, 7 Jun 2021 11:35:42 +0300 From: Dan Carpenter To: Wenli Looi Cc: Greg Kroah-Hartman , linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org, "Fabio M. De Francesco" Subject: Re: [PATCH v2] staging: rtl8723bs: Fix uninitialized variable Message-ID: <20210607083542.GP1955@kadam> References: <7256195.zb9d8qvCYo@linux.local> <20210606184638.13650-1-wlooi@ucalgary.ca> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210606184638.13650-1-wlooi@ucalgary.ca> User-Agent: Mutt/1.9.4 (2018-02-28) X-Proofpoint-GUID: u3VTU-lBdpLmrzlKUOrtAW8cCklGFaCP X-Proofpoint-ORIG-GUID: u3VTU-lBdpLmrzlKUOrtAW8cCklGFaCP Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Jun 06, 2021 at 11:46:38AM -0700, Wenli Looi wrote: > Uninitialized struct with invalid pointer causes BUG and prevents access > point from working. Access point works once I apply this patch. > > This problem seems to have been present from the time the driver was > added to staging. Most users probably do not use access point so they > will not encounter this bug. > > https://forum.armbian.com/topic/14727-wifi-ap-kernel-bug-in-kernel-5444/ > has more details. > > kzalloc() seems to be what other drivers are doing in the same situation > of creating struct station_info and calling cfg80211_new_sta. In > particular, other drivers like ath6kl and mwifiex will silently return > when kzalloc fails, so this seems like the right behavior. (mwifiex > returns -ENOMEM from the place kzalloc is called, but if you follow the > chain of calls, the return value is ultimately ignored) > > Links to same situation in other drivers: > https://github.com/torvalds/linux/blob/f5b6eb1e018203913dfefcf6fa988649ad11ad6e/drivers/net/wireless/ath/ath6kl/main.c#L488 > https://github.com/torvalds/linux/blob/f5b6eb1e018203913dfefcf6fa988649ad11ad6e/drivers/net/wireless/marvell/mwifiex/uap_event.c#L120 > > Signed-off-by: Wenli Looi > --- > > v1 -> v2: Switched from large stack variable to kzalloc Nah, v1 was better, it just needs an updated commit message. See my other email for more details. regards, dan carpenter