Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp1197485pxv; Fri, 23 Jul 2021 02:18:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJymS2WYoxfRr9HLwL2X/W15Gi1dqqFdcnvzb8k1lNhpZS3cRyRNLt56SURZR4ax8788koC+ X-Received: by 2002:a02:aa8b:: with SMTP id u11mr3275252jai.43.1627031919689; Fri, 23 Jul 2021 02:18:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1627031919; cv=none; d=google.com; s=arc-20160816; b=Q+v10gN2YyIzkUVdyOCktu4FlYKghhqqMe6IXRH2zt2PanZ8WVRKAy8f1H9wJ/9IlQ itm9FXWTGmPnPrP7AHBtZIwlrn/BXGYXLWDCazxUmt6cSe4JMx40croG3sMnTPiHxm2P 4GzhbTbLliHP90V9RE4zkexQ3f1U35+DTpTMW/u8h6+kfJpEcXQyFWgixFaE/sNiZmPC mKnTbSYS1TZs8RkXyk+NwRxWbmEum/WcMACAt4TmVZxGgndpli/GXbSZAGK81HsYq0ao rmnaVeVZvwEeBRaZ9t4MKrlM38pXsT6ZJ8JLuw7WkwDFMPlt7nLlsnW4mVuDkVXhCoWz Gklw== 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 :user-agent:references:in-reply-to:date:cc:to:from:subject :message-id:dkim-signature; bh=K0D57hY2oduItIBhxD08gu3o/OffxO5BlZSmT2p5cZc=; b=PoSLFs1+sAoSyrHVamJxZaLCeQpeZ7rI9f8JqqayXGRziRKoA91KoFc43tP9dz0NDO sY2EomrdBQHvoeA5DbGQ2jRkl7KXUC+6JukG29oYbKG1/RRm3nNRjmJH/vJ+n2yEw5YX 736ticqjfbWsZ6gLmvun4KWBFHL4BkwOaYx76zT3pnoi0SjQotngnEoM7E7Dr5Vzv5tm RK3wO0SF2vOtqDvIQ6ogMFQr2V8Ahxh4k/3ZuQU8sO10+8UbBrXOArLG77ZgKQhUDPQd ymLxq7EYXqwdi9FX7zNjGRjp7m3Gx+a6Es/kg4m1qO6r+IYK3IlzWBhpi59P97CmhyWN 1hIw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sipsolutions.net header.s=mail header.b=tZIS8ZhK; 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=REJECT dis=NONE) header.from=sipsolutions.net Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w25si21814627iot.26.2021.07.23.02.18.28; Fri, 23 Jul 2021 02:18:39 -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=@sipsolutions.net header.s=mail header.b=tZIS8ZhK; 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=REJECT dis=NONE) header.from=sipsolutions.net Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234214AbhGWIhu (ORCPT + 99 others); Fri, 23 Jul 2021 04:37:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48290 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231994AbhGWIht (ORCPT ); Fri, 23 Jul 2021 04:37:49 -0400 Received: from sipsolutions.net (s3.sipsolutions.net [IPv6:2a01:4f8:191:4433::2]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4C9FDC061575; Fri, 23 Jul 2021 02:18:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sipsolutions.net; s=mail; h=Content-Transfer-Encoding:MIME-Version: Content-Type:References:In-Reply-To:Date:Cc:To:From:Subject:Message-ID:Sender :Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-To: Resent-Cc:Resent-Message-ID; bh=K0D57hY2oduItIBhxD08gu3o/OffxO5BlZSmT2p5cZc=; t=1627031903; x=1628241503; b=tZIS8ZhKdrx0Zip5fcU06KVeEFWdoYsQBzFDAG0rzUMf7pg R9B8ufPPVyh9+7iyi2tRZzOHSO5+0aQOUD4qCJ7XDLXn/+zSBolHiOdSxhbhWPCPpIrD0GRvk78Cr ktRpbW0ml+2fVf6PjewzDEuA/6BZbi1Gi4Zwrhb3meFmWSO48jw6U90py+W8xdo1Gr8yJCBwozSGQ 7n8JytqDclH0Z4Jyq/oQ2wYqn45ysE6ZOuXmQX4uurUt2HCuCUigFwmMoKca7jTBMumB9f1bKuMJN XFvo4eyyTbD0DMoptsdwTSfhLKaW6ovSPiqgbmaGnWuaeoTBaHU38nJrBt1McdKA==; Received: by sipsolutions.net with esmtpsa (TLS1.3:ECDHE_SECP256R1__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim 4.94.2) (envelope-from ) id 1m6rHI-000TqY-HV; Fri, 23 Jul 2021 11:18:11 +0200 Message-ID: <11ba299b812212a07fe3631b7be0e8b8fd5fb569.camel@sipsolutions.net> Subject: Re: [PATCH] cfg80211: free the object allocated in wiphy_apply_custom_regulatory From: Johannes Berg To: Dongliang Mu 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 Date: Fri, 23 Jul 2021 11:18:10 +0200 In-Reply-To: References: <20210723050919.1910964-1-mudongliangabcd@gmail.com> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.38.4 (3.38.4-1.fc33) MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-malware-bazaar: not-scanned Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org 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? johannes