public inbox for stable@vger.kernel.org
 help / color / mirror / Atom feed
From: Sasha Levin <sashal@kernel.org>
To: stable@vger.kernel.org
Cc: Yu Kuai <yukuai1@huaweicloud.com>, Sasha Levin <sashal@kernel.org>
Subject: Re: [PATCH 6.1 2/2] md: fix mddev uaf while iterating all_mddevs list
Date: Sat, 19 Apr 2025 08:19:32 -0400	[thread overview]
Message-ID: <20250419081136-34ad419abdc11548@stable.kernel.org> (raw)
In-Reply-To: <20250419012303.85554-3-yukuai1@huaweicloud.com>

[ Sasha's backport helper bot ]

Hi,

✅ All tests passed successfully. No issues detected.
No action required from the submitter.

The upstream commit SHA1 provided is correct: 8542870237c3a48ff049b6c5df5f50c8728284fa

WARNING: Author mismatch between patch and upstream commit:
Backport author: Yu Kuai<yukuai1@huaweicloud.com>
Commit author: Yu Kuai<yukuai3@huawei.com>

Status in newer kernel trees:
6.14.y | Present (different SHA1: 5462544ccbad)
6.13.y | Not found
6.12.y | Not found
6.6.y | Not found

Note: The patch differs from the upstream commit:
---
1:  8542870237c3a ! 1:  dd49667d64662 md: fix mddev uaf while iterating all_mddevs list
    @@ Metadata
      ## Commit message ##
         md: fix mddev uaf while iterating all_mddevs list
     
    +    commit 8542870237c3a48ff049b6c5df5f50c8728284fa upstream.
    +
         While iterating all_mddevs list from md_notify_reboot() and md_exit(),
         list_for_each_entry_safe is used, and this can race with deletint the
         next mddev, causing UAF:
    @@ Commit message
         Closes: https://lore.kernel.org/all/Z7Y0SURoA8xwg7vn@bender.morinfr.org/
         Signed-off-by: Yu Kuai <yukuai3@huawei.com>
         Reviewed-by: Christoph Hellwig <hch@lst.de>
    +    [skip md_seq_show() that is not exist]
    +    Signed-off-by: Yu Kuai <yukuai3@huawei.com>
     
      ## drivers/md/md.c ##
     @@ drivers/md/md.c: static void __mddev_put(struct mddev *mddev)
    @@ drivers/md/md.c: static void __mddev_put(struct mddev *mddev)
      void mddev_put(struct mddev *mddev)
      {
      	if (!atomic_dec_and_lock(&mddev->active, &all_mddevs_lock))
    -@@ drivers/md/md.c: static int md_seq_show(struct seq_file *seq, void *v)
    - 	if (mddev == list_last_entry(&all_mddevs, struct mddev, all_mddevs))
    - 		status_unused(seq);
    - 
    --	if (atomic_dec_and_test(&mddev->active))
    --		__mddev_put(mddev);
    --
    -+	mddev_put_locked(mddev);
    - 	return 0;
    - }
    - 
     @@ drivers/md/md.c: EXPORT_SYMBOL_GPL(rdev_clear_badblocks);
      static int md_notify_reboot(struct notifier_block *this,
      			    unsigned long code, void *x)
---

Results of testing on various branches:

| Branch                    | Patch Apply | Build Test |
|---------------------------|-------------|------------|
| stable/linux-6.6.y        |  Success    |  Success   |

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

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-19  1:23 [PATCH 6.1 0/2] md: fix mddev uaf while iterating all_mddevs list Yu Kuai
2025-04-19  1:23 ` [PATCH 6.1 1/2] md: factor out a helper from mddev_put() Yu Kuai
2025-04-19 12:19   ` Sasha Levin
2025-04-19  1:23 ` [PATCH 6.1 2/2] md: fix mddev uaf while iterating all_mddevs list Yu Kuai
2025-04-19 12:19   ` Sasha Levin [this message]
2025-04-23 18:14 ` [PATCH 6.1 0/2] " Salvatore Bonaccorso
2025-04-24  6:40   ` Greg KH
2025-04-24  9:32     ` Salvatore Bonaccorso
2025-04-24 10:26       ` Greg KH

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=20250419081136-34ad419abdc11548@stable.kernel.org \
    --to=sashal@kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=yukuai1@huaweicloud.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