All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Sterba <dsterba@suse.cz>
To: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Cc: David Sterba <dsterba@suse.com>,
	linux-btrfs@vger.kernel.org, Anand Jain <anand.jain@oracle.com>,
	Nikolay Borisov <nborisov@suse.com>,
	syzbot+582e66e5edf36a22c7b0@syzkaller.appspotmail.com
Subject: Re: [PATCH v2] btrfs: don't access possibly stale fs_info data for printing duplicate device
Date: Mon, 16 Nov 2020 16:38:33 +0100	[thread overview]
Message-ID: <20201116153833.GO6756@twin.jikos.cz> (raw)
In-Reply-To: <0e9eb675e0a199bf034f13c58fbe5678f4e94a3c.1605513154.git.johannes.thumshirn@wdc.com>

On Mon, Nov 16, 2020 at 04:52:54PM +0900, Johannes Thumshirn wrote:
> Syzbot reported a possible use-after-free when printing a duplicate device
> warning device_list_add().
> 
> At this point it can happen that a btrfs_device::fs_info is not correctly
> setup yet, so we're accessing stale data, when printing the warning
> message using the btrfs_printk() wrappers.
> 
> Instead of printing possibly uninitialized or already freed memory in
> btrfs_printk(), explicitly pass in a NULL fs_info so the printing of the
> device name will be skipped altogether.

This would be good to add some info about the evolution of the fix, also
a comment saying why we can't use fs_info.

  parent reply	other threads:[~2020-11-16 15:40 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-16  7:52 [PATCH v2] btrfs: don't access possibly stale fs_info data for printing duplicate device Johannes Thumshirn
2020-11-16  7:59 ` Nikolay Borisov
2020-11-16 15:38 ` David Sterba [this message]
2020-11-17  7:20 ` Anand Jain
2020-11-17  8:19   ` Johannes Thumshirn
2020-11-17 10:50     ` Anand Jain

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=20201116153833.GO6756@twin.jikos.cz \
    --to=dsterba@suse.cz \
    --cc=anand.jain@oracle.com \
    --cc=dsterba@suse.com \
    --cc=johannes.thumshirn@wdc.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=nborisov@suse.com \
    --cc=syzbot+582e66e5edf36a22c7b0@syzkaller.appspotmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.