]> www.infradead.org Git - users/hch/xfsprogs.git/commitdiff
xfs: fix misuse of the XFS_ATTR_INCOMPLETE flag
authorChristoph Hellwig <hch@lst.de>
Sat, 14 Mar 2020 02:59:39 +0000 (22:59 -0400)
committerEric Sandeen <sandeen@sandeen.net>
Sat, 14 Mar 2020 02:59:39 +0000 (22:59 -0400)
Source kernel commit: 780d29057781d986cd87dbbe232cd02876ad430f

XFS_ATTR_INCOMPLETE is a flag in the on-disk attribute format, and thus
in a different namespace as the ATTR_* flags in xfs_da_args.flags.
Switch to using a XFS_DA_OP_INCOMPLETE flag in op_flags instead.  Without
this users might be able to inject this flag into operations using the
attr by handle ioctl.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
libxfs/xfs_attr.c
libxfs/xfs_attr_leaf.c
libxfs/xfs_da_btree.h
libxfs/xfs_da_format.h

index ccf58703de01055533af6f744cc3c2c14d0a6a19..800dd2b2107620c6af7251503247ff19540f6655 100644 (file)
@@ -1006,7 +1006,7 @@ restart:
                 * The INCOMPLETE flag means that we will find the "old"
                 * attr, not the "new" one.
                 */
-               args->flags |= XFS_ATTR_INCOMPLETE;
+               args->op_flags |= XFS_DA_OP_INCOMPLETE;
                state = xfs_da_state_alloc();
                state->args = args;
                state->mp = mp;
index 219736ac222f66be857e552a4cc71a4f3b28d2cd..541a1fffcbe3121d5622aa83da0077a3bd8016ce 100644 (file)
@@ -2400,8 +2400,8 @@ xfs_attr3_leaf_lookup_int(
                 * If we are looking for INCOMPLETE entries, show only those.
                 * If we are looking for complete entries, show only those.
                 */
-               if ((args->flags & XFS_ATTR_INCOMPLETE) !=
-                   (entry->flags & XFS_ATTR_INCOMPLETE)) {
+               if (!!(args->op_flags & XFS_DA_OP_INCOMPLETE) !=
+                   !!(entry->flags & XFS_ATTR_INCOMPLETE)) {
                        continue;
                }
                if (entry->flags & XFS_ATTR_LOCAL) {
index e16610d1c14f3396b25ade839974604fbd4fda29..0f4fbb0889ffced8fdec8245b2ecca3d35b20504 100644 (file)
@@ -89,6 +89,7 @@ typedef struct xfs_da_args {
 #define XFS_DA_OP_OKNOENT      0x0008  /* lookup/add op, ENOENT ok, else die */
 #define XFS_DA_OP_CILOOKUP     0x0010  /* lookup to return CI name if found */
 #define XFS_DA_OP_ALLOCVAL     0x0020  /* lookup to alloc buffer if found  */
+#define XFS_DA_OP_INCOMPLETE   0x0040  /* lookup INCOMPLETE attr keys */
 
 #define XFS_DA_OP_FLAGS \
        { XFS_DA_OP_JUSTCHECK,  "JUSTCHECK" }, \
@@ -96,7 +97,8 @@ typedef struct xfs_da_args {
        { XFS_DA_OP_ADDNAME,    "ADDNAME" }, \
        { XFS_DA_OP_OKNOENT,    "OKNOENT" }, \
        { XFS_DA_OP_CILOOKUP,   "CILOOKUP" }, \
-       { XFS_DA_OP_ALLOCVAL,   "ALLOCVAL" }
+       { XFS_DA_OP_ALLOCVAL,   "ALLOCVAL" }, \
+       { XFS_DA_OP_INCOMPLETE, "INCOMPLETE" }
 
 /*
  * Storage for holding state during Btree searches and split/join ops.
index 3dee33043e09b330f420bd94e66c8c41be5a7565..05615d1f411320803124c542957d002fc8cdd60c 100644 (file)
@@ -683,8 +683,6 @@ struct xfs_attr3_leafblock {
 
 /*
  * Flags used in the leaf_entry[i].flags field.
- * NOTE: the INCOMPLETE bit must not collide with the flags bits specified
- * on the system call, they are "or"ed together for various operations.
  */
 #define        XFS_ATTR_LOCAL_BIT      0       /* attr is stored locally */
 #define        XFS_ATTR_ROOT_BIT       1       /* limit access to trusted attrs */