Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp389460rwe; Thu, 25 Aug 2022 02:08:55 -0700 (PDT) X-Google-Smtp-Source: AA6agR59/+wtejBvMc/ChtssXOVFwA7eW9xnpNTk+bdyor8+NSHqUyCpiXoe1pcO3VAR8zCRXXyz X-Received: by 2002:a05:6a00:1d8c:b0:536:c30a:241e with SMTP id z12-20020a056a001d8c00b00536c30a241emr3204039pfw.25.1661418535132; Thu, 25 Aug 2022 02:08:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661418535; cv=none; d=google.com; s=arc-20160816; b=LSZY+YGXgrlkVPyDhujTfkBVB1tTL5amwGTqsSEp71UvSqGx/e1W/NocuDyKr0mH2+ gk9icpk2ZK71nXwZDnDA1ePWiwdpm2wQGshvDLRiWI/oZOH5TomIPNZOjl5Ji0RHVIGG 9Ofu76ax6gYBgst/GessCY+HA9XoEksBkSUVWhskB4vhOkORZardRhpzrq4saKeCGSrc tAyYEIy3g2xC0RF7+NFlpU+XUo50R3n/TiXvJHYKsYGzDmbBpsA/q3nV3wmxpPiDyr2i YC2IpNdUze3xeuTcEaECaWijt1GRPQhc9eTAbBgQpKgvduRIU2vbKxbPqThgGBEbAh5a bEVg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent :content-transfer-encoding:references:in-reply-to:date:to:from :subject:message-id:dkim-signature; bh=TzCYlDNiVvmXbs381yU8jvL/C2667hpnhrK4Ggtij3c=; b=oiHdgzV5zIRNEWaOeDR9Et2Ar2cFHE2egyOHMk8BGkFENXS/QNyLqGx2P/gQRM6NKK QukMPWzodzLrbPd5WONUYri1W3vWb76rpWuEjMZXVife8FU+QvP7g4o4+FHJJVgBWb+u OOYnT39HMd6mGhmaC+XAJNtjHBJGTZN9zyHpQlCiG+oXdmQFedxgDKu2sc/i8n/0eAnY V/rphThLzArL1IK2t9H9fKSfcpzluv0tmOkVVQamDg3OyjzaXiJCWcpagdBSWmvjUbbz xL1A1bubif/SIXZ0PFac3J+lRjZYklY1dVZM9uuVxSGrhXeapupngz70Zk56/wTfoKHj BDRw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sipsolutions.net header.s=mail header.b=rN2fZmGX; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m23-20020a6562d7000000b0041b135b0de2si17658853pgv.454.2022.08.25.02.08.46; Thu, 25 Aug 2022 02:08:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@sipsolutions.net header.s=mail header.b=rN2fZmGX; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S235303AbiHYJCc (ORCPT + 63 others); Thu, 25 Aug 2022 05:02:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52864 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237854AbiHYJC3 (ORCPT ); Thu, 25 Aug 2022 05:02:29 -0400 Received: from sipsolutions.net (s3.sipsolutions.net [IPv6:2a01:4f8:191:4433::2]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0535D4F664 for ; Thu, 25 Aug 2022 02:02:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sipsolutions.net; s=mail; h=MIME-Version:Content-Transfer-Encoding: Content-Type:References:In-Reply-To:Date:To:From:Subject:Message-ID:Sender: Reply-To:Cc:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-To: Resent-Cc:Resent-Message-ID; bh=TzCYlDNiVvmXbs381yU8jvL/C2667hpnhrK4Ggtij3c=; t=1661418149; x=1662627749; b=rN2fZmGX/FMr67tsk0BNkEVDK0fT35A4GlTFqJmustIH8OB A2BjhWFNWecJcrVQ0BTpBXQl0vEbLtZWceb+YGYq2ohiAsHxvaCzKGf/gySATtrEnIiSG+aTFbMXv cQDv0Ytnu4tTwBLo8qj9LQpomcfpLTMD3HDDBc7NlXN/J4/usZBcVxHfFfkHobPHi8kImQlgy5965 j63DzOtXV8d8JiUtkcuKoNZ0Jvl3DvjVTKS5XS1wVYfOKq3IZVDvg+scN1ihcc6iJFKq3sTHV+0Sd Xtr7nICfvcmRQ8PR01tN+aDaiv7h6Lg3LBRXtTW/oM8aLWYc/qr3xNfTJlx0EkZg==; Received: by sipsolutions.net with esmtpsa (TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim 4.96) (envelope-from ) id 1oR8kt-00Gzg4-1K; Thu, 25 Aug 2022 11:02:27 +0200 Message-ID: Subject: Re: [PATCH v2 2/2] mac80211: Support POWERED_ADDR_CHANGE feature From: Johannes Berg To: James Prestwood , linux-wireless@vger.kernel.org Date: Thu, 25 Aug 2022 11:02:26 +0200 In-Reply-To: <20220811231338.563794-3-prestwoj@gmail.com> References: <20220811231338.563794-1-prestwoj@gmail.com> <20220811231338.563794-3-prestwoj@gmail.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.44.4 (3.44.4-1.fc36) MIME-Version: 1.0 X-malware-bazaar: not-scanned 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_PASS,SPF_PASS, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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 On Thu, 2022-08-11 at 16:13 -0700, James Prestwood wrote: > @@ -217,7 +275,11 @@ static int ieee80211_change_mac(struct net_device *d= ev, void *addr) > if (ret) > return ret; > =20 > + if (live) > + drv_remove_interface(local, sdata); > ret =3D eth_mac_addr(dev, sa); > + if (live) > + ret =3D drv_add_interface(local, sdata); > =20 > if (ret =3D=3D 0) > memcpy(sdata->vif.addr, sa->sa_data, ETH_ALEN); >=20 I still don't like the (lack of) error checking here. As far as I know, eth_mac_addr() can very happily fail if the passed address is invalid, so we really shouldn't overwrite the ret value by drv_add_interface(). Also, it seems like we should only add the interface again after updating sdata->vif.addr (last context line), so that the driver actually knows ... otherwise I'm not sure how this patch would have much effect (unless it updates the FW all the time like iwlwifi, which I guess is where you tested it, based on the rationale...) johannes