Merge tag 'for-6.6-rc5-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/kdave...
authorLinus Torvalds <torvalds@linux-foundation.org>
Wed, 11 Oct 2023 20:58:32 +0000 (13:58 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Wed, 11 Oct 2023 20:58:32 +0000 (13:58 -0700)
Pull btrfs fixes from David Sterba:
 "A revert of recent mount option parsing fix, this breaks mounts with
  security options.

  The second patch is a flexible array annotation"

* tag 'for-6.6-rc5-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux:
  btrfs: add __counted_by for struct btrfs_delayed_item and use struct_size()
  Revert "btrfs: reject unknown mount options early"

fs/btrfs/delayed-inode.c
fs/btrfs/delayed-inode.h
fs/btrfs/super.c

index caf0bbd..90aaedc 100644 (file)
@@ -313,7 +313,7 @@ static struct btrfs_delayed_item *btrfs_alloc_delayed_item(u16 data_len,
 {
        struct btrfs_delayed_item *item;
 
-       item = kmalloc(sizeof(*item) + data_len, GFP_NOFS);
+       item = kmalloc(struct_size(item, data, data_len), GFP_NOFS);
        if (item) {
                item->data_len = data_len;
                item->type = type;
index dc1085b..1da2131 100644 (file)
@@ -95,7 +95,7 @@ struct btrfs_delayed_item {
        bool logged;
        /* The maximum leaf size is 64K, so u16 is more than enough. */
        u16 data_len;
-       char data[];
+       char data[] __counted_by(data_len);
 };
 
 static inline void btrfs_init_delayed_root(
index f49e597..1a093ec 100644 (file)
@@ -954,10 +954,6 @@ static int btrfs_parse_subvol_options(const char *options, char **subvol_name,
 
                        *subvol_objectid = subvolid;
                        break;
-               case Opt_err:
-                       btrfs_err(NULL, "unrecognized mount option '%s'", p);
-                       error = -EINVAL;
-                       goto out;
                default:
                        break;
                }