Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp1118538pxj; Wed, 2 Jun 2021 21:53:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwYtST2lbv3o/LkSfYS4aNCHK94J22hiiRAKFZIl6fauC42F5qGxyAME8TCM3Ug/3oGIczX X-Received: by 2002:a50:fc84:: with SMTP id f4mr22722932edq.252.1622696017406; Wed, 02 Jun 2021 21:53:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622696017; cv=none; d=google.com; s=arc-20160816; b=cBcZV6oq1IOnaMZQ+4ASE2i7c9a1t3rtmYlw724Zzv5T7vjMxRxgt4/9mkIRP8/7il QFob/l8MVLzzCOxUyWJ6TXTXZhibREYzrGWU/IM3RgWsaJ2Ef/7GMb7AjtIiC9lds9zm W98N9bVK5u7nt5wj/7eHdTa5vATjycC6gshZLeKV43vYYwevyxmt+KZZFTkWDNKb2y51 RH6YTsWNybhqwWua6YTJSDYBtjuiDa7BDflOcY7tIT7dIzOaUlvXAk0Jp5C50DaPL+Hv W+/iGYzzKJauUHGvrR/SBWW2znuFGyvWQ3A+UiFzEu++ZAtnF5ZUwrhl2mAh3Q+l/TGU 7yMg== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=zqKGPh2sFHvHDPUOdf/BuenLWamDTQPRfxgjQFjdLik=; b=ktoh3vX8PL9rCuLBhr3OVryacty9BCTodn+HiPH+zKJTqPjOAuRl01nhQT143RUw7W 1c76cAYeWOv+2J5gUZM2ZbVdlJ40AaT5cain0TMbGv0aIUl2OTAWEPF1wZsxXVc6Ct3S fuS3RA0g3PNhixzbf+c5CPHHLqQ5OCYYvbYt0lJxniO0RGfiz8Di9aajlCz5VQWw08xo OwVyA74JxvFIrxzJJUjMMkfkyRjEVa09i5Njwaaz2QHVQRUttjMqBoq04i4qulJxEIbu nNrywqHhsnBm0kIhgDO9iYm4YYbwW/W9NkjrkFPI4iFK4u4HbRDYfrIj/YlnPMBFbsHP sM9Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=ICtBHhnl; 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 t27si1333995ejd.372.2021.06.02.21.53.15; Wed, 02 Jun 2021 21:53:37 -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=ICtBHhnl; 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 S229786AbhFCEwE (ORCPT + 99 others); Thu, 3 Jun 2021 00:52:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58248 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229758AbhFCEwD (ORCPT ); Thu, 3 Jun 2021 00:52:03 -0400 Received: from mail-lf1-x12e.google.com (mail-lf1-x12e.google.com [IPv6:2a00:1450:4864:20::12e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 49687C06174A; Wed, 2 Jun 2021 21:50:07 -0700 (PDT) Received: by mail-lf1-x12e.google.com with SMTP id a5so6899341lfm.0; Wed, 02 Jun 2021 21:50:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=zqKGPh2sFHvHDPUOdf/BuenLWamDTQPRfxgjQFjdLik=; b=ICtBHhnlYLayEfFAoEECXkECT70TRWFmqt4dq4WM6UJl5dzo2g9YbRs/WmEtsrPcGQ PwVkJpSRlwjO5Q6XtXpqGIP5Dnb5tTYxEAeY5lo78JTpO3qIBiUyqJSsFtN51RvZj/XG CsNAw2Sq1F72HCZng8kueeQbflC/gdlpJAVtoKZifaJbOEF9S0Z/CsFH2sIpiZ6ZwHlm xYVHYQs6dBUJZYC0I54ZCATW/YgkYFazxx7yqcEmN/WCWKgrldmBOqRLf5tuBacAyuGw 0Lfn1n6JjFG91s/CB9j1tlYUAVxKjl02MNc/rCjzS+1rcddp6p8fwzGSDZbfkLBo+2eo Auuw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=zqKGPh2sFHvHDPUOdf/BuenLWamDTQPRfxgjQFjdLik=; b=VzspNt1zwf2FjVww8xOQiJSCf2lk98yEceXok6MYzcaDoBlGeSQG3tbFEgQ4HOkrcZ 6TXXOvyrbmdVHoYJauxJwYmTwPK2bAqlxh49l6Mx/o38wPnQT/vDcO3AKhWaTe29vTB7 fkunKYojiBbW314OuJUUc8SLQLYY4XefT57D/4wcRcWFICTTBdyp3jQTQtSWHoi0PbN4 489OShVbUWTl2W3OPQMvJhZtdYhm/G1gK2MMXmvr0puaHOhGP+Yl15a2maF4NbdLWn7B hyHuz1BYjrD26wsOZtD5MkWv9Pg/rFgS+W5UKL3m5ekPcAQmzgn7aavs2Tnk4skg1m0h 2QRg== X-Gm-Message-State: AOAM533+tiHEIvu0Q2KGurJRQkYWGmwz5UVrSxNS5GlaCYogx/LabcTX nxzDWVBj/0ES0WCtqyDfYlk= X-Received: by 2002:a05:6512:411:: with SMTP id u17mr11418179lfk.287.1622695804290; Wed, 02 Jun 2021 21:50:04 -0700 (PDT) Received: from rsa-laptop.internal.lan ([217.25.229.52]) by smtp.gmail.com with ESMTPSA id z2sm191328lfe.229.2021.06.02.21.50.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Jun 2021 21:50:03 -0700 (PDT) From: Sergey Ryazanov To: Johannes Berg , Loic Poulain Cc: M Chetan Kumar , linux-wireless@vger.kernel.org, netdev@vger.kernel.org Subject: [RFC 1/6] rtnetlink: fix alloc() method introduction Date: Thu, 3 Jun 2021 07:49:49 +0300 Message-Id: <20210603044954.8091-2-ryazanov.s.a@gmail.com> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210603044954.8091-1-ryazanov.s.a@gmail.com> References: <20210603044954.8091-1-ryazanov.s.a@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org RTNL checks for the setup() callback existing in a few place as a sanity check. The introduction of the alloc() method makes the setup() method optional. So allow RTNL families that define at least one alloc() or setup() method. Fixes: ???? ("rtnetlink: add alloc() method to rtnl_link_ops") Signed-off-by: Sergey Ryazanov --- net/core/rtnetlink.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c index 49a27bf6e4a7..56ac16abe0ba 100644 --- a/net/core/rtnetlink.c +++ b/net/core/rtnetlink.c @@ -376,12 +376,12 @@ int __rtnl_link_register(struct rtnl_link_ops *ops) if (rtnl_link_ops_get(ops->kind)) return -EEXIST; - /* The check for setup is here because if ops + /* The check for alloc/setup is here because if ops * does not have that filled up, it is not possible * to use the ops for creating device. So do not * fill up dellink as well. That disables rtnl_dellink. */ - if (ops->setup && !ops->dellink) + if ((ops->alloc || ops->setup) && !ops->dellink) ops->dellink = unregister_netdevice_queue; list_add_tail(&ops->list, &link_ops); @@ -3421,7 +3421,7 @@ static int __rtnl_newlink(struct sk_buff *skb, struct nlmsghdr *nlh, return -EOPNOTSUPP; } - if (!ops->setup) + if (!ops->alloc && !ops->setup) return -EOPNOTSUPP; if (!ifname[0]) { -- 2.26.3