Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp1178627pxv; Fri, 23 Jul 2021 01:38:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxlEjgMvp/ybyVKhT/HfasWvrgxTYtfjc3Djy4TaOupVGGiqeqvkcgIxneLYrzxtTSJQBxc X-Received: by 2002:a6b:1685:: with SMTP id 127mr3178194iow.135.1627029507914; Fri, 23 Jul 2021 01:38:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1627029507; cv=none; d=google.com; s=arc-20160816; b=uHK0TwPvAzuwN6WZc17CuUv2kcJVfB0jE+jV5tnL3yYGolsopj6QLIFaYML/FQijxF q6lMF3TwsmhBEoSGMzjyRMaThvtUr6HzdRv+v/Qfpm2G9rPSfts5CEgCPO8TITJAh3YV 8CCVK6O4S6nEfeiNA40HYs9weMHkvwwiO0mUJjiKfBK1yiwedwZkq3CAYaRJa7MqIUxM 6q7HQorQYejyLX4sUA1gpNEah7cW+05C7NK+CyiAX+qzXOrgnvMezJdVSZpk+h7j+OvK RYOyAwkGBnfYCxA9t4Rp7Fy6bgXua1eCxHKhlElSuzwQv4DUFOIeSxm80o7jmoiaaTID n7Vg== 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=Obk6U+ay+sgJKpQCJECzXauTigDtAdD5YjEfRLDjgZw=; b=VobcKLWwHICo5CZgr3of3TC+Yps8scZ+W+ZSxlWK3HoX7aSNsJe4DpRDbKxC8vVVNK u1oAjMDKL1WrCOfEKr+tZEv22WCl4Po6Z6HTx5iF7AAe7+WymnjYGhHKcwEbUgFvVSzJ XkbA7BG+8EPffVJtU1LIRRfe18wOtan362gzxqOGuVSH37VBnsKe7asE2Pu9Ii7BGrNq g05NDvXvTuCwpdBsvahxOOsrd3+oUf0soJd61ZoShJznMQrVW/8/+HDGsA9AGn919TAR jR8KELICJe36L70EQBw7c06qzzIC/lEBKpTMkTvVR/Q9LSXnTPNohIjLHX30keVWTEcx 77dA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sipsolutions.net header.s=mail header.b=u7Ax3Yfc; 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 x29si32439485jap.52.2021.07.23.01.38.12; Fri, 23 Jul 2021 01:38:27 -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=u7Ax3Yfc; 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 S234517AbhGWH52 (ORCPT + 99 others); Fri, 23 Jul 2021 03:57:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38908 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229907AbhGWH52 (ORCPT ); Fri, 23 Jul 2021 03:57:28 -0400 Received: from sipsolutions.net (s3.sipsolutions.net [IPv6:2a01:4f8:191:4433::2]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D2B05C061575; Fri, 23 Jul 2021 01:38:01 -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=Obk6U+ay+sgJKpQCJECzXauTigDtAdD5YjEfRLDjgZw=; t=1627029481; x=1628239081; b=u7Ax3Yfch2go1+9IrDAoBy4M7xiYnOU6I9tStZ3+nLi9QHF M7y/0KaDoUidVY8s2XDMAxbfiz29syLv3fdjSighb7P4Z64rXZo06aZGcF6VSnHTqsicdb+bcjM3P 0eomAYt1HcBqpLkL0zg6rFE+wkc1oPFvGu0QUHyMQhi9zK7ENfIRqLcxd2HApL4psiKRZfHRIm97q t3MCje3nZb21hVYKGU1TQvvrj8t8nFZgM6p1HHcWFznmf1zaiqbitobCr8i4lGMZNQ5/9YYvl4nif PaGHS99xuIIwlJiUSi3l9EuRp3TMK+lqP2JSmUZyOjv9IGoqPVmpB2QUZXJq+T7A==; 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 1m6qeC-000T4h-Vr; Fri, 23 Jul 2021 10:37:47 +0200 Message-ID: Subject: Re: [PATCH] cfg80211: free the object allocated in wiphy_apply_custom_regulatory From: Johannes Berg To: Dongliang Mu , Kalle Valo , "David S. Miller" , Jakub Kicinski , Luca Coelho , Ilan Peer Cc: syzbot+1638e7c770eef6b6c0d0@syzkaller.appspotmail.com, linux-wireless@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Date: Fri, 23 Jul 2021 10:37:45 +0200 In-Reply-To: <20210723050919.1910964-1-mudongliangabcd@gmail.com> 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 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? + new_regd = reg_copy_regd(regd); + if (IS_ERR(new_regd)) + return; + + tmp = get_wiphy_regdom(wiphy); + rcu_assign_pointer(wiphy->regd, new_regd); + rcu_free_regdom(tmp); > Fix this by freeing the regd object in the error handling code and > deletion function - mac80211_hwsim_del_radio. This can't be right - the same would affect all other users of that function, no? Perhaps somewhere we have a case where wiphy->regd is leaked, but than that should be fixed more generally in cfg80211? johannes