Linux Kernel Mentees list
 help / color / mirror / Atom feed
From: Hillf Danton <hdanton@sina.com>
To: Anirudh Rayabharam <mail@anirudhrb.com>
Cc: syzbot+de271708674e2093097b@syzkaller.appspotmail.com,
	"Rafael J. Wysocki" <rafael@kernel.org>,
	linux-kernel@vger.kernel.org,
	Luis Chamberlain <mcgrof@kernel.org>,
	Junyong Sun <sunjy516@gmail.com>,
	linux-kernel-mentees@lists.linuxfoundation.org
Subject: Re: [PATCH v4] firmware_loader: fix use-after-free in firmware_fallback_sysfs
Date: Thu, 20 May 2021 11:52:28 +0800	[thread overview]
Message-ID: <20210520035228.1537-1-hdanton@sina.com> (raw)
In-Reply-To: <YKVfTKkxrn72TDqe@anirudhrb.com>

On Thu, 20 May 2021 00:26:12 +0530 Anirudh Rayabharam wrote:
>On Wed, May 19, 2021 at 05:10:47PM +0800, Hillf Danton wrote:
>> 
>> Fine, apart from what you are fixing, you are adding something like
>> finish_wait() into the waker's backyard. Why are you calling
>> complete_all() on the waiter side?
>
>Sorry, I don't really get your point here. I did not add complete_all().
>It was already there. Could you please elaborate?

If a simple pattern works for you,

 	mutex_lock(&fw_lock);
 	list_add(&fw_priv->pending_list, &pending_fw_head);
 	mutex_unlock(&fw_lock);

	retval = fw_sysfs_wait_timeout(fw_priv, timeout);

 	mutex_lock(&fw_lock);
	list_del_init(&fw_priv->pending_list);
 	mutex_unlock(&fw_lock);

	device_del(f_dev);
	put_device(f_dev);
	return retval;

add a followup cleanup to cut off the list_del on the waker side instead of
putting a spanner in their work that is completing all waiters.
_______________________________________________
Linux-kernel-mentees mailing list
Linux-kernel-mentees@lists.linuxfoundation.org
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees

      reply	other threads:[~2021-05-20  3:58 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-18 15:59 [PATCH v4] firmware_loader: fix use-after-free in firmware_fallback_sysfs Anirudh Rayabharam
2021-05-19  3:20 ` Luis Chamberlain
2021-05-19 18:44   ` Anirudh Rayabharam
2021-06-10 22:32   ` Luis Chamberlain
2021-06-11  3:16     ` Anirudh Rayabharam
2021-05-19  9:10 ` Hillf Danton
2021-05-19 18:56   ` Anirudh Rayabharam
2021-05-20  3:52     ` Hillf Danton [this message]

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=20210520035228.1537-1-hdanton@sina.com \
    --to=hdanton@sina.com \
    --cc=linux-kernel-mentees@lists.linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mail@anirudhrb.com \
    --cc=mcgrof@kernel.org \
    --cc=rafael@kernel.org \
    --cc=sunjy516@gmail.com \
    --cc=syzbot+de271708674e2093097b@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox