mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: barebox@lists.infradead.org
Cc: Ahmad Fatoum <a.fatoum@pengutronix.de>
Subject: [PATCH] fs: fix overlap of O_RWSIZE with new O_PATH/O_CHROOT flags
Date: Fri,  8 Mar 2024 15:20:47 +0100	[thread overview]
Message-ID: <20240308142047.3890639-1-a.fatoum@pengutronix.de> (raw)

O_PATH had the same value as O_RWSIZE_2, while O_CHROOT overlapped with
O_RWSIZE_4. Fix this by moving up the bits used for O_PATH and O_CHROOT.

This resolves the EINVAL reported when running md -w 0.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
This fixes a regression in next cause by:
  fs: implement O_PATH
  fs: implement O_CHROOT

@Sascha, could you apply the changes to each commit individually, so
there's no regression? Alternatively, I can resent these two commits
to replace what's in next.
---
 include/fcntl.h | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/include/fcntl.h b/include/fcntl.h
index 532a3a0f6b1e..a746471411b5 100644
--- a/include/fcntl.h
+++ b/include/fcntl.h
@@ -23,11 +23,6 @@
 #define O_APPEND	00002000
 #define O_DIRECTORY	00200000	/* must be a directory */
 #define O_NOFOLLOW	00400000	/* don't follow links */
-#define O_PATH		02000000	/* open as path */
-#define O_CHROOT	04000000	/* dirfd: stay within filesystem root */
-#define __O_TMPFILE	020000000
-
-#define O_TMPFILE       (__O_TMPFILE | O_DIRECTORY)
 
 /* barebox additional flags */
 #define O_RWSIZE_MASK	017000000
@@ -37,6 +32,12 @@
 #define O_RWSIZE_4	004000000
 #define O_RWSIZE_8	010000000
 
+#define __O_TMPFILE	020000000
+#define O_PATH		040000000	/* open as path */
+#define O_CHROOT	0100000000	/* dirfd: stay within filesystem root */
+
+#define O_TMPFILE       (__O_TMPFILE | O_DIRECTORY)
+
 int openat(int dirfd, const char *pathname, int flags);
 
 static inline int open(const char *pathname, int flags, ...)
-- 
2.39.2




                 reply	other threads:[~2024-03-08 14:21 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240308142047.3890639-1-a.fatoum@pengutronix.de \
    --to=a.fatoum@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox