mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: David Sterba <dsterba@suse.cz>
To: Daniel Vacek <neelx@suse.com>
Cc: Chris Mason <clm@fb.com>, Josef Bacik <josef@toxicpanda.com>,
	David Sterba <dsterba@suse.com>, Nick Terrell <terrelln@fb.com>,
	linux-btrfs@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3 2/2] btrfs: harden parsing of compress mount options
Date: Thu, 12 Jun 2025 17:18:51 +0200	[thread overview]
Message-ID: <20250612151851.GD4037@suse.cz> (raw)
In-Reply-To: <CAPjX3FdyMGKGFch-k=CmOD7wP_as_iaB9hmnbbui5=off+m+iQ@mail.gmail.com>

On Thu, Jun 12, 2025 at 03:29:21PM +0200, Daniel Vacek wrote:
> On Mon, 2 Jun 2025 at 19:29, David Sterba <dsterba@suse.cz> wrote:
> >
> > On Mon, Jun 02, 2025 at 05:53:19PM +0200, Daniel Vacek wrote:
> > > Btrfs happily but incorrectly accepts the `-o compress=zlib+foo` and similar
> > > options with any random suffix.
> > >
> > > Fix that by explicitly checking the end of the strings.
> > >
> > > Signed-off-by: Daniel Vacek <neelx@suse.com>
> > > ---
> > > v3 changes: Split into two patches to ease backporting,
> > >             no functional changes.
> > >
> > >  fs/btrfs/super.c | 26 +++++++++++++++++++-------
> > >  1 file changed, 19 insertions(+), 7 deletions(-)
> > >
> > > diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c
> > > index 6291ab45ab2a5..4510c5f7a785e 100644
> > > --- a/fs/btrfs/super.c
> > > +++ b/fs/btrfs/super.c
> > > @@ -270,9 +270,20 @@ static inline blk_mode_t btrfs_open_mode(struct fs_context *fc)
> > >       return sb_open_mode(fc->sb_flags) & ~BLK_OPEN_RESTRICT_WRITES;
> > >  }
> > >
> > > +static bool btrfs_match_compress_type(char *string, char *type, bool may_have_level)
> >
> > const also here, string, type
> >
> > > +{
> > > +     int len = strlen(type);
> > > +
> > > +     return strncmp(string, type, len) == 0 &&
> > > +             ((may_have_level && string[len] == ':') ||
> > > +                                 string[len] == '\0');
> > > +}
> > > +
> > >  static int btrfs_parse_compress(struct btrfs_fs_context *ctx,
> > >                               struct fs_parameter *param, int opt)
> > >  {
> > > +     char *string = param->string;
> >
> > and here
> 
> Can be done at merge time. Or do you want a re-send?

No resend needed, I updated the patch in for-next. This was to let you
know so that I don't need to fix it in future patches.

  reply	other threads:[~2025-06-12 15:19 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-02 15:53 [PATCH v3 0/2] " Daniel Vacek
2025-06-02 15:53 ` [PATCH v3 1/2] btrfs: factor out compress mount options parsing Daniel Vacek
2025-06-02 17:28   ` David Sterba
2025-06-02 15:53 ` [PATCH v3 2/2] btrfs: harden parsing of compress mount options Daniel Vacek
2025-06-02 17:29   ` David Sterba
2025-06-12 13:29     ` Daniel Vacek
2025-06-12 15:18       ` David Sterba [this message]
2025-06-02 17:28 ` [PATCH v3 0/2] " David Sterba

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=20250612151851.GD4037@suse.cz \
    --to=dsterba@suse.cz \
    --cc=clm@fb.com \
    --cc=dsterba@suse.com \
    --cc=josef@toxicpanda.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=neelx@suse.com \
    --cc=terrelln@fb.com \
    /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

all inboxes | Powered by JetHome®