public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Hillf Danton <hdanton@sina.com>
To: syzbot <syzbot+28c1a5a5b041a754b947@syzkaller.appspotmail.com>
Cc: linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com
Subject: Re: [syzbot] [sound?] possible deadlock in snd_pcm_period_elapsed (4)
Date: Sat, 16 Mar 2024 09:23:02 +0800	[thread overview]
Message-ID: <20240316012302.1634-1-hdanton@sina.com> (raw)
In-Reply-To: <0000000000002a81490613b2affb@google.com>

#syz test https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git  master

--- x/sound/core/timer.c
+++ y/sound/core/timer.c
@@ -409,8 +409,9 @@ static void snd_timer_close_locked(struc
 	struct snd_timer *timer = timeri->timer;
 
 	if (timer) {
-		guard(spinlock)(&timer->lock);
+		spin_lock_irq(&timer->lock);
 		timeri->flags |= SNDRV_TIMER_IFLG_DEAD;
+		spin_unlock_irq(&timer->lock);
 	}
 
 	if (!list_empty(&timeri->open_list)) {
--- x/drivers/virtio/virtio_ring.c
+++ y/drivers/virtio/virtio_ring.c
@@ -316,7 +316,13 @@ static void *vring_alloc_queue(struct vi
 		return dma_alloc_coherent(dma_dev, size,
 					  dma_handle, flag);
 	} else {
-		void *queue = alloc_pages_exact(PAGE_ALIGN(size), flag);
+		void *queue;
+		unsigned long sz = PAGE_ALIGN(size);
+		unsigned int order = 0;
+
+		while ((PAGE_SIZE << order) < sz)
+			order++;
+		queue = (void *) __get_free_pages(flag, order);
 
 		if (queue) {
 			phys_addr_t phys_addr = virt_to_phys(queue);
@@ -334,7 +340,7 @@ static void *vring_alloc_queue(struct vi
 			 * unrepresentable address.
 			 */
 			if (WARN_ON_ONCE(*dma_handle != phys_addr)) {
-				free_pages_exact(queue, PAGE_ALIGN(size));
+				free_pages((unsigned long) queue, order);
 				return NULL;
 			}
 		}
@@ -348,8 +354,14 @@ static void vring_free_queue(struct virt
 {
 	if (vring_use_dma_api(vdev))
 		dma_free_coherent(dma_dev, size, queue, dma_handle);
-	else
-		free_pages_exact(queue, PAGE_ALIGN(size));
+	else {
+		unsigned long sz = PAGE_ALIGN(size);
+		unsigned int order = 0;
+
+		while ((PAGE_SIZE << order) < sz)
+			order++;
+		free_pages((unsigned long) queue, order);
+	}
 }
 
 /*
--

  parent reply	other threads:[~2024-03-16  1:23 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-15 10:00 [syzbot] [sound?] possible deadlock in snd_pcm_period_elapsed (4) syzbot
2024-03-15 10:14 ` Takashi Iwai
2024-03-15 13:07 ` syzbot
2024-03-15 13:13   ` Hillf Danton
2024-03-15 13:44     ` syzbot
2024-03-15 23:34   ` Hillf Danton
2024-03-15 23:53     ` syzbot
2024-03-16  1:23   ` Hillf Danton [this message]
2024-03-16  2:37     ` syzbot
2024-03-16  5:39   ` Hillf Danton
2024-03-16  6:04     ` syzbot
2024-03-16  8:13   ` Hillf Danton
2024-03-16  8:32     ` syzbot

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=20240316012302.1634-1-hdanton@sina.com \
    --to=hdanton@sina.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=syzbot+28c1a5a5b041a754b947@syzkaller.appspotmail.com \
    --cc=syzkaller-bugs@googlegroups.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