Received: by 2002:a05:7412:f584:b0:e2:908c:2ebd with SMTP id eh4csp1924474rdb; Tue, 5 Sep 2023 09:00:40 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHSxVt6LG69XxqHS438a7XSnCWJ8An6Cx/GtqZTRb+5IEq4nb3snHLGX9T/HrJ4o9rBO7za X-Received: by 2002:a17:90b:4ad0:b0:262:fba6:59b5 with SMTP id mh16-20020a17090b4ad000b00262fba659b5mr9264946pjb.24.1693929640260; Tue, 05 Sep 2023 09:00:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1693929640; cv=none; d=google.com; s=arc-20160816; b=TVO6Nu7Wo+DYRuHwAxD+0f8RjxfAd9Zvv+ehZ3wOdNGwEQ5m/2OGfxRgpk1glsIatp hr3CGnAJYmlkgoKIbpJAX0fGZ5h764I4oiRkV704VF9AQjGeAI/qv6bN4RuvgMLpuEra Zl9uGPo/0aDJkizsQvFH+TfKsR3JO6A8qo3Q9mb51ix8/6B/dQXbO3KlzEEr6U8RT7N9 PC/dMgKr2Nnw824/zzdx41zJ3h+TAsYHwIDekHVnuv9ALOP0fCTUvYFpwUvh7D6oLyCk 26wSujTgM3f2z9J9ZeuMIHI0LCjqJByUMfQcUh9H6wFsvMoX1xFb5g9k2Rp/H/84LgFk AN2w== 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; bh=wsGj/By1L5B4hMy2OQnJ6fNGd/zzZdrlVFpYroV1qv4=; fh=HYA7Slyre3OXY0bNpmznUTUmpJlmx2zYQto5A2ZSyFk=; b=0CmyPH9VTMpKx3gLCYsuMh4DDOZsv4f0I+MAFrMEv5REEPH7jAdMvs1qRW9c1/R7SK c9F+GT1JcRguSdSbhKCcXLlbL4VMsQEF9nDVp44MyTORIWg6xb2ff9AU46DLGSexYrVS z65AJ1Rp0agdajmgOO0jcXyjbQBLJLbJP+4eeOfgPCzyiwiOeI/u6QFuX7w/dqrEYHQ7 +8aW5W62BoI3L0fdnW9wy5qcbF4t5gLm4oKmEHhgRvxlqfcNkGkiX+Ac7VLY4rTVraEj sAUfgrTcRDAusYA5T1GhAAaoCr+JgAzQQ7UZNLPCRAr4IIz5vmdY8lfIF25mrnyeWLyc gYAA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id il4-20020a17090b164400b00271a0262e88si13125355pjb.4.2023.09.05.09.00.35; Tue, 05 Sep 2023 09:00:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-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; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1353335AbjIDQZu (ORCPT + 21 others); Mon, 4 Sep 2023 12:25:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42938 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1353334AbjIDQZt (ORCPT ); Mon, 4 Sep 2023 12:25:49 -0400 Received: from mail-ej1-f54.google.com (mail-ej1-f54.google.com [209.85.218.54]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B8C041980; Mon, 4 Sep 2023 09:25:41 -0700 (PDT) Received: by mail-ej1-f54.google.com with SMTP id a640c23a62f3a-99bf3f59905so249412666b.3; Mon, 04 Sep 2023 09:25:41 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1693844740; x=1694449540; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=wsGj/By1L5B4hMy2OQnJ6fNGd/zzZdrlVFpYroV1qv4=; b=JE0neR/+7jwAH5Gggc9dCrRPn1rUCcBQ5T9Qnz+YeU86pxkO4ZIXSsHrD1R/Nb44Pp CCikSpqdXo63g9j2GDgVvvGfemQKTDOze9v+AV3WOCtAgDwMkHJFkJnDrUb8zldMON3Z gbgX/NfjyNO54JlYivxzOjTYpUFLlAC6GG77oTLnkpGzyjQoKuPDAgBA1XhpVDC62otw JW9nloloiEDRGbBg2Pa0CCfI2st9Na5YAh9gKersREfxLZVI0UOdORxDPAIAZNlFOGJU jvHFFLoomcvbYiQhnDzf/+H/JzQ4AQ8tq5z7Q2ksAs1VLczfUHiKJWpxy/XbzJWCTh0v yoSg== X-Gm-Message-State: AOJu0Yz2YF/d/M1nrzodvz68KWtOmEgqWeWSTl0vEWmOaQfMfRSEwDvo f63MJV+taiZrhysKWQy6vRgWCMj7+a3nIw== X-Received: by 2002:a17:906:76c8:b0:99b:4668:865f with SMTP id q8-20020a17090676c800b0099b4668865fmr7688934ejn.10.1693844739936; Mon, 04 Sep 2023 09:25:39 -0700 (PDT) Received: from localhost (fwdproxy-cln-116.fbsv.net. [2a03:2880:31ff:74::face:b00c]) by smtp.gmail.com with ESMTPSA id f25-20020a170906495900b0099d9dee8108sm6447486ejt.149.2023.09.04.09.25.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Sep 2023 09:25:39 -0700 (PDT) From: Breno Leitao To: sdf@google.com, axboe@kernel.dk, asml.silence@gmail.com, willemdebruijn.kernel@gmail.com, martin.lau@linux.dev, krisman@suse.de Cc: bpf@vger.kernel.org, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, io-uring@vger.kernel.org, kuba@kernel.org, pabeni@redhat.com Subject: [PATCH v4 07/10] io_uring/cmd: return -EOPNOTSUPP if net is disabled Date: Mon, 4 Sep 2023 09:25:00 -0700 Message-Id: <20230904162504.1356068-8-leitao@debian.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230904162504.1356068-1-leitao@debian.org> References: <20230904162504.1356068-1-leitao@debian.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.4 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL, SPF_HELO_NONE,SPF_PASS autolearn=no 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-kernel@vger.kernel.org Protect io_uring_cmd_sock() to be called if CONFIG_NET is not set. If network is not enabled, but io_uring is, then we want to return -EOPNOTSUPP for any possible socket operation. This is helpful because io_uring_cmd_sock() can now call functions that only exits if CONFIG_NET is enabled without having #ifdef CONFIG_NET inside the function itself. Signed-off-by: Breno Leitao --- io_uring/uring_cmd.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/io_uring/uring_cmd.c b/io_uring/uring_cmd.c index 60f843a357e0..6a91e1af7d05 100644 --- a/io_uring/uring_cmd.c +++ b/io_uring/uring_cmd.c @@ -167,6 +167,7 @@ int io_uring_cmd_import_fixed(u64 ubuf, unsigned long len, int rw, } EXPORT_SYMBOL_GPL(io_uring_cmd_import_fixed); +#if defined(CONFIG_NET) int io_uring_cmd_sock(struct io_uring_cmd *cmd, unsigned int issue_flags) { struct socket *sock = cmd->file->private_data; @@ -192,4 +193,11 @@ int io_uring_cmd_sock(struct io_uring_cmd *cmd, unsigned int issue_flags) return -EOPNOTSUPP; } } +#else +int io_uring_cmd_sock(struct io_uring_cmd *cmd, unsigned int issue_flags) +{ + return -EOPNOTSUPP; +} +#endif + EXPORT_SYMBOL_GPL(io_uring_cmd_sock); -- 2.34.1