Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp1203708pxv; Fri, 23 Jul 2021 02:31:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxAUK9CC4+GKRU1Ywj5qW8Tcc44qCbzFkVcjTErPacqlVaeyO4W6/rs1s5RO+jM4BGOaCAH X-Received: by 2002:a92:c0c3:: with SMTP id t3mr2887100ilf.80.1627032693893; Fri, 23 Jul 2021 02:31:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1627032693; cv=none; d=google.com; s=arc-20160816; b=xBynqPVpGCgC1gCY5UKVpYMef7nyBmfOkiBzN+deZu78eGeOvML4XhniDgDmiJbyBi YTd0bMKKLOUFkWHKsTmHf0REnYYufisTdW417NjjR6WPKgB3walrbQ+pD/BhpIKpkqwy 2Jld3o5Xnzyzg6jD44hgVP44/srEQy82jVoeS40fCew9Oi/rnsVN+qF2pJRcb0vDjtMN pIfSX/NljAccaMlA/VvbF3qhUPRFm0lDXohPxhwrzXSuWlYml4ietRfenU2yftSq+OQh n+o8Oi1aucbjNmw1jQTgkWPD5vuQFpqpAH078ZzcyAslEdWxzLaDIRhGnydgevraAmXl kbEA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=ao2RnG7ISGLnAa4hG4vDQIREJNPq/pTbnRjpX9KH6vY=; b=GBaL9yYWd1DwSHhhKPs75UNjO4xObmYApICFoQH1rXoITgOdLAdFnH3UWJY6pD+3/P l5gSkkKIFeMyIiBW/6kYfWt4p9vX+KeDiF1Mafa8m/RUKFHY8brEZFh+oINsqq1mpwB2 SSv9FL7O9+wJf4eSvQZTR5CJGzxekvFBcwCgrTWPvmAMOLReb8riQx3xpvm13Rs/LoJT SEcTFrTt3qPWPsQF0rxUNe4GYjnIXZezhjKp8C2WbrmEC5IN7f5Dac0dNJzvT+vG8uth USjvZ8S7cjJ8pedeMVEoYiedyDuCiupfB5IQ1Jn95Gz3Lkg8qkaVeFZ0HGkOSsASw3mh lkkA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=FS8hYJMt; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r8si10488109jar.122.2021.07.23.02.31.21; Fri, 23 Jul 2021 02:31:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless-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=@gmail.com header.s=20161025 header.b=FS8hYJMt; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232231AbhGWIul (ORCPT + 99 others); Fri, 23 Jul 2021 04:50:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51254 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229949AbhGWIul (ORCPT ); Fri, 23 Jul 2021 04:50:41 -0400 Received: from mail-ed1-x530.google.com (mail-ed1-x530.google.com [IPv6:2a00:1450:4864:20::530]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0E20FC061575; Fri, 23 Jul 2021 02:31:14 -0700 (PDT) Received: by mail-ed1-x530.google.com with SMTP id h10so933543edv.8; Fri, 23 Jul 2021 02:31:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=ao2RnG7ISGLnAa4hG4vDQIREJNPq/pTbnRjpX9KH6vY=; b=FS8hYJMt0WhpUPxRpcq7UOVN0vy83RBinj5w0q65KdLgaiDpl/Guqj2usyZdTeY1TC OjIiw8+Tw7y571dJ5uHAvzqioHPYPXb8JwZUBB+bV4CS6H1xF78pUZqOUKQe+e7ej86H SK+mLKCmfxVGmDUFNgx1ICeFuu5DflY3PepgZXPERNWIP2oTj3xdydKO5p8UHwAkCuSO gPqat8PgATLyYL1T2IAps4QnWkAPlJROIXAkfEkkXqG6u7qHj4su33FcINeDXjCXP4d/ OGRtF7Zmf5EwAitlUpUWsnJE8nME9s8PRzdLhyEk9SQ5qjOWDmraMQrg1SKngF2AVKyE tVeQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=ao2RnG7ISGLnAa4hG4vDQIREJNPq/pTbnRjpX9KH6vY=; b=ub3qmQRuIMVUfAN+X9aiBsEdYFVW7CnrHK5ojyTv2aOx8SLUfqh0ny1TjPo3I1U2ei FTSoOR2STIUyT06hRr6uajrY9pQEGMhslytUNUfGM4ZzAPRykVjrcrR7P+gcNWHIbrxf A1k70xNyptMzWvmM8EQRriy7sgDv0cfbyyReYBOGs5iYkcX9OG093ZQj9iU5Cx+ax+7u jQjdIe6iLE51zMbm3CNcasTX+qZeEyxMs5uPHhbqPB4JwpyyRZ0pc7i1QP28NktF39I3 4V73xyFwQvy3EEsqjsThen+zxXI1IcB4c6LK2zrMy01xM9U5TyvfIWN1+zDa8CmPNgHZ RMtA== X-Gm-Message-State: AOAM532hPcHx/PAAZ8a41X18aQQumcOh9xfljhAM9Nz8bhi5Qx8EpyrY 0apYGjVkXflMlAYJr1FRjLvp49c5nVXL8mfWEdg= X-Received: by 2002:a05:6402:1c10:: with SMTP id ck16mr4375755edb.339.1627032672678; Fri, 23 Jul 2021 02:31:12 -0700 (PDT) MIME-Version: 1.0 References: <20210723050919.1910964-1-mudongliangabcd@gmail.com> <11ba299b812212a07fe3631b7be0e8b8fd5fb569.camel@sipsolutions.net> In-Reply-To: <11ba299b812212a07fe3631b7be0e8b8fd5fb569.camel@sipsolutions.net> From: Dongliang Mu Date: Fri, 23 Jul 2021 17:30:46 +0800 Message-ID: Subject: Re: [PATCH] cfg80211: free the object allocated in wiphy_apply_custom_regulatory To: Johannes Berg Cc: Kalle Valo , "David S. Miller" , Jakub Kicinski , Luca Coelho , Ilan Peer , syzbot+1638e7c770eef6b6c0d0@syzkaller.appspotmail.com, linux-wireless@vger.kernel.org, "open list:NETWORKING [GENERAL]" , linux-kernel , Dan Carpenter Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org On Fri, Jul 23, 2021 at 5:18 PM Johannes Berg wrote: > > On Fri, 2021-07-23 at 17:13 +0800, Dongliang Mu wrote: > > On Fri, Jul 23, 2021 at 4:37 PM Johannes Berg wrote: > > > > > > On Fri, 2021-07-23 at 13:09 +0800, Dongliang Mu wrote: > > > > The commit beee24695157 ("cfg80211: Save the regulatory domain when > > > > setting custom regulatory") forgets to free the newly allocated regd > > > > object. > > > > > > Not really? It's not forgetting it, it just saves it? > > > > Yes, it saves the regd object in the function wiphy_apply_custom_regulatory. > > Right. > > > But its parent function - mac80211_hwsim_new_radio forgets to free > > this object when the ieee80211_register_hw fails. > > But why is this specific to mac80211-hwsim? > > Any other code calling wiphy_apply_custom_regulatory() and then failing > the subsequent wiphy_register() or otherwise calling wiphy_free() will > run into the same situation. > > So why wouldn't we free this in wiphy_free(), if it exists? > Hi Johannes, if zhao in the thread is right, we don't need to add this free operation to wiphy_free(). What we should do is to only handle regd in the error handling code of mac80211_hwsim_new_radio. This will not affect other users of mac80211-hwsim. Any idea? > johannes >