From patchwork Mon Sep 18 12:32:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Max Kellermann X-Patchwork-Id: 141521 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:172:b0:3f2:4152:657d with SMTP id h50csp2886888vqi; Mon, 18 Sep 2023 12:04:41 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGyctgWuETfPVEV0hAfyQ/T/vQvTLtEBrEVriGD3nJtOi9BGwLqgdljuhG0uqq3Nj2qI6gt X-Received: by 2002:a05:6a20:4304:b0:121:ca90:df01 with SMTP id h4-20020a056a20430400b00121ca90df01mr9694193pzk.40.1695063881005; Mon, 18 Sep 2023 12:04:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695063880; cv=none; d=google.com; s=arc-20160816; b=M7sz6gkHwqhCF4zRrq7amvHx15BIOae5Rs8OdNSQOHmxguh4QEDnBZfgMFEFhqO2vd /vvPfEB+WYQm48J0jc60AeN7ta7iODrcMf+Dq6CLVUbiy575j63+OEIXzVrmy+8lq5vZ evsb8CCT55brtzaZYqKsSYhZIMk1DWLA1+MPtMxoc3CN25Y8GykJhBT8EAjZdfnrQgoP 3AggGXBGeE2u2H7Z49aNhjp4Oh4lY+x18jlpC1wZGqts1N67+KSG8I1siL1jvLlslKRu l2RUcOgsIRCdFLMoWbhCwUlxlzC63ikMMHMNBC9emINFOa3dJrzwDWHMsFarxuaEJz/U JpWQ== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=bTIpQ2wCkQ3gsn9IN2OtZFBrX++kayidfIH0DbMWLuA=; fh=wd7qOuYAeNqOqTJ3FnCoYa4/XxYdErzLkNb6cLbRrzw=; b=NfDY969pSzNKnQ6lHwfkl7qgx6xKjTz4wGtKPwRVzwfKyByBugagzPzppEQYK5g85n WA484bw5ekm3Fo/bchP9DSSNz+5DjuuqcwuHX09OUAwEDJ9bhK8R4MimKz26+OmVfva1 klypYFjEP9WrLhAi4HJMtX8bg+8GbVFNKv7oR8EhHMifefZsY9FSO2WAjFJ+ZmUuw+pQ MdUFTRD6XMs3w0fQe1/z2LGChBcNPZZPLAXjyjK1z+PeNPYCt7ky+3gsfmd4RlHV4H53 UMjCsINViafYmaX1l26VidoLs5IbTVGMyQLwmN09gYrulkgwrm/aqs7viYi5CKPGWPVG Pxuw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ionos.com header.s=google header.b=fJJU9BqT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=ionos.com Received: from pete.vger.email (pete.vger.email. [23.128.96.36]) by mx.google.com with ESMTPS id cn9-20020a056a00340900b0068fcccf5c79si8486264pfb.220.2023.09.18.12.04.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Sep 2023 12:04:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) client-ip=23.128.96.36; Authentication-Results: mx.google.com; dkim=pass header.i=@ionos.com header.s=google header.b=fJJU9BqT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=ionos.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id 029D381C4AA6; Mon, 18 Sep 2023 05:33:56 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241167AbjIRMdV (ORCPT + 27 others); Mon, 18 Sep 2023 08:33:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37610 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241216AbjIRMcu (ORCPT ); Mon, 18 Sep 2023 08:32:50 -0400 Received: from mail-ej1-x62a.google.com (mail-ej1-x62a.google.com [IPv6:2a00:1450:4864:20::62a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5357311C for ; Mon, 18 Sep 2023 05:32:31 -0700 (PDT) Received: by mail-ej1-x62a.google.com with SMTP id a640c23a62f3a-9ad8a33fd0dso564658266b.3 for ; Mon, 18 Sep 2023 05:32:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ionos.com; s=google; t=1695040350; x=1695645150; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=bTIpQ2wCkQ3gsn9IN2OtZFBrX++kayidfIH0DbMWLuA=; b=fJJU9BqTIihg7qWtYW0OAU0Reg/jv7ksGHuJmnrEXD2jsFE2+cews4dZFPDxn+80iS 8b7uHs/e/18DlFnNn63JImv9m9pgPze8a8p3T8Yx28CJgbdPHPMlPP/P3U3bjDtGhSCY OHrDqqfJUa+SKehcgYVlwpjV/hqSdls4G1LpcQv8XWisfr8lUg4CQMimVybhcycoRoxw owEiJZoEEA7nZGQnt6KXjK5fk5nd9YRe9VyWt5VGdKECs6J3y1WMVfiQD5rJyEdK/uZN B70h4cUIOzjqR2jkBxNpM5uC5Hz6BToCy4F4VvqS/tCjiidpQRy8mCGaWqADn52r10Zl JGUg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695040350; x=1695645150; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=bTIpQ2wCkQ3gsn9IN2OtZFBrX++kayidfIH0DbMWLuA=; b=j3umV96HLx8Ol74T32jF/NnL+b/GU23MJRsRBHvVJzcljpcWRyBAG/KE+yaOAsmAzJ JY03vonmOHAeiapZGZKwLKt6qSw88XSoSAd/WnZtDtOazjYg6TkecgXB5dQrOsGb+5yT YKAW9sQTf0Fc0S5azY1e8TaoBcsgmjStewX4uyyJnuCGGs8nWvfYuL5sM4nbu/SQdXwb 7aRZOX53yi31m5cVdfqoCHWQnTjk8Ec3Eb4Tpy0a7gW1vJgr3xa+h8rEg5hoqVohrZlS joLWMM6ZpVj+uaqnYexcmcrGGJBqR+vDc9WUClP3otwJ84QG8i9zm+cG6E6LcOIc2GAR CPtQ== X-Gm-Message-State: AOJu0YwHduDhKm+gxj6iK5i/LFM/XX+04Ul9D4zeYlCP0fHijsNel8Wt ija7CKiYt/cioCBljuBuu1l4tw== X-Received: by 2002:a17:907:7888:b0:9ad:e244:911e with SMTP id ku8-20020a170907788800b009ade244911emr6635009ejc.55.1695040349768; Mon, 18 Sep 2023 05:32:29 -0700 (PDT) Received: from heron.intern.cm-ag (p200300dc6f209c00529a4cfffe3dd983.dip0.t-ipconnect.de. [2003:dc:6f20:9c00:529a:4cff:fe3d:d983]) by smtp.gmail.com with ESMTPSA id sd5-20020a170906ce2500b00992a8a54f32sm6328834ejb.139.2023.09.18.05.32.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Sep 2023 05:32:29 -0700 (PDT) From: Max Kellermann To: jack@suse.cz, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Cc: amir73il@gmail.com, max.kellermann@ionos.com Subject: [PATCH 1/4] inotify_user: pass directory fd to inotify_find_inode() Date: Mon, 18 Sep 2023 14:32:14 +0200 Message-Id: <20230918123217.932179-1-max.kellermann@ionos.com> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (pete.vger.email [0.0.0.0]); Mon, 18 Sep 2023 05:33:57 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1777403304164054443 X-GMAIL-MSGID: 1777403304164054443 Preparing for inotify_add_watch_at(). To: Jan Kara Cc: Amir Goldstein To: linux-fsdevel@vger.kernel.org To: linux-kernel@vger.kernel.org Signed-off-by: Max Kellermann --- fs/notify/inotify/inotify_user.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/fs/notify/inotify/inotify_user.c b/fs/notify/inotify/inotify_user.c index 1c4bfdab008d..1853439a24f6 100644 --- a/fs/notify/inotify/inotify_user.c +++ b/fs/notify/inotify/inotify_user.c @@ -370,12 +370,12 @@ static const struct file_operations inotify_fops = { /* * find_inode - resolve a user-given path to a specific inode */ -static int inotify_find_inode(const char __user *dirname, struct path *path, +static int inotify_find_inode(int dfd, const char __user *dirname, struct path *path, unsigned int flags, __u64 mask) { int error; - error = user_path_at(AT_FDCWD, dirname, flags, path); + error = user_path_at(dfd, dirname, flags, path); if (error) return error; /* you can only watch an inode if you have read permissions on it */ @@ -774,7 +774,7 @@ SYSCALL_DEFINE3(inotify_add_watch, int, fd, const char __user *, pathname, if (mask & IN_ONLYDIR) flags |= LOOKUP_DIRECTORY; - ret = inotify_find_inode(pathname, &path, flags, + ret = inotify_find_inode(AT_FDCWD, pathname, &path, flags, (mask & IN_ALL_EVENTS)); if (ret) goto fput_and_out;