Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp932554rwe; Thu, 25 Aug 2022 11:49:28 -0700 (PDT) X-Google-Smtp-Source: AA6agR7XL5+OPeNMjtkdD1jPiogwuL5OXYlroiYck8ZLgkFM+hs5BbqEN/cuxb8QQkj3qBOGVD8u X-Received: by 2002:a17:907:1c9b:b0:73d:62e2:f1ec with SMTP id nb27-20020a1709071c9b00b0073d62e2f1ecmr3299078ejc.60.1661453368388; Thu, 25 Aug 2022 11:49:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661453368; cv=none; d=google.com; s=arc-20160816; b=TLyXoMWG+iZlMqU0SlqdWLU+499Ho/yUjxqsDYI2JGddXJM2k4qUTj9Bcpzrjqlm7b UvhYWdvcoYg8Wkvq9X3MhZzkMCJTVmosNMRLspM1OpRTtiueedr4fD6+FBSa9LrhyM7p 2P3K7GLzlLUta4syUcCwZSSzOjf67D+bhrH9Vvak07DiiUJ5OiiETBpj0xByhZncJViH uavFxRIKclxKnQisgltrcvFOwPLRVjbbI2stL8NLJyfZPtLimUgnGUCMacDPRzmniqVI a34B7bZV89jLXuVU68II8AlerYQ2yUSiokq1W/TOXDZCIeoFHso33rFdPqqENjlo9rZL TZiw== 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=ns0r/7+N5c7+Pc6XkSNv8jQEQfXT4KB6Y3fTCqHo8Hg=; b=CBvQS5h1DKEtR78qQMsNQ1+qHXA6dj+/LSXWgp2S8IfaRjykIw2qy7mPpydu5hR2Hd nzrEvZoWrTpNsrl5kLwL6SkQfITYbJuSNp0pXyM2cj2GSmFrdiI3Vm9qnUYjKcqHTgFK qJnX94Qb4Fdv67HXDvGorSMh/dNwIneAyhyEIeNOUHUFK3U8g5bh2OhpPltiTfIOQ4JR 0KLHVNCVNvrEATLX+ftmgVLkCFHjuXdItIsLWpu75D6TJrdlhj8TU/TVmobweCkihUIE DmC1cQog6+A1iZIlKCgavzBxwjRCVzCT7Tpom1nkyMNsnR717/ZTUmc9jal8wjvan3u7 J97g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sipsolutions.net header.s=mail header.b=Mp+XhuuA; 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 sd22-20020a170906ce3600b0073d8bc42e00si3339534ejb.1004.2022.08.25.11.49.05; Thu, 25 Aug 2022 11:49:28 -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=Mp+XhuuA; 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 S241625AbiHYSmj (ORCPT + 64 others); Thu, 25 Aug 2022 14:42:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37998 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234877AbiHYSmi (ORCPT ); Thu, 25 Aug 2022 14:42:38 -0400 Received: from sipsolutions.net (s3.sipsolutions.net [IPv6:2a01:4f8:191:4433::2]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7D3478C460 for ; Thu, 25 Aug 2022 11:42:36 -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=ns0r/7+N5c7+Pc6XkSNv8jQEQfXT4KB6Y3fTCqHo8Hg=; t=1661452956; x=1662662556; b=Mp+XhuuAUrzR6gNI8lJncDeUr2sOuKuaHCBwVVs+rYUJvyc mu2jIppSaRtQ0hsd00g/A9PiSIKGGTm1BGZ1FkVUzxUtV7HiLpijoDpHy0GYbvw+A+UvOs11GS/zM 0os2vDHeP5+XY1/rAQz7+o10OZqJpA9z65FwWlokRpEhk4TbXQtIZSduLn+uatthaFcLji+WDGFQq N7oCFZtVD1IsLm3Qwy4EDFxQJ7RTvGki6BAkIEWRX9ekmjQu/kBv3tDOhfeEfKhhJRu4po3H4GmfR ktMyfIdYNyGiJZeI3fmRFMir5//HIGnLv/VMthGBE5gXmp/GapTviV6/M5/aSrqA==; Received: by sipsolutions.net with esmtpsa (TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim 4.96) (envelope-from ) id 1oRHoH-00H9ar-2I; Thu, 25 Aug 2022 20:42:33 +0200 Message-ID: <6fa6b1b62f6a1bc945708cca9e27136f1737386f.camel@sipsolutions.net> 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 20:42:32 +0200 In-Reply-To: <1cdf35f95aca2a65d0d738544fb04079125b9581.camel@gmail.com> References: <20220811231338.563794-1-prestwoj@gmail.com> <20220811231338.563794-3-prestwoj@gmail.com> <1cdf35f95aca2a65d0d738544fb04079125b9581.camel@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 Hi, =C2=A0 > > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0if (live) > > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0drv_remove_interface(local, sdata); > > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0ret =3D eth_mac_addr(= dev, sa); > > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0if (live) > > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0ret =3D drv_add_interface(local, sdata); > > > =C2=A0 > > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0if (ret =3D=3D 0) > > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0memcpy(sdata->vif.addr, sa->sa_data, ETH_ALEN); > > >=20 > >=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(). >=20 > Ah yes, that was an oversight. I assume we do want to add_interface > even if eth_mac_addr fails though. Right. > So my only question is about the > return from drv_add_interface(). Is this unlikely to fail? If so would > just a WARN_ON be sufficient and return the value from eth_mac_addr()? Hm, yeah, I guess it really ought to not fail here. > So something like: >=20 > if (live) > drv_remove_interface(local, sdata); > ret =3D eth_mac_addr(dev, sa); > if (ret =3D=3D 0) > memcpy(sdata->vif.addr, sa->sa_data, ETH_ALEN); >=20 > if (live) > WARN_ON(drv_add_interface(local, sdata)); >=20 > return ret; Seems reasonable. We could do something like err =3D drv_add_interface(...); if (err) { dev_close(...); ret =3D ret ?: err; } or something, but not sure that's worth it, it really shouldn't fail at this point. But I guess we could leave setting NL80211_EXT_FEATURE_AUTH_TX_RANDOM_TA to the driver if we think it'd be less risky that way? johannes