Re: [syzbot] [dri?] [media?] inconsistent lock state in valid_state (2)

From: Hillf Danton
Date: Tue Feb 27 2024 - 05:53:37 EST


On Mon, 26 Feb 2024 16:56:17 -0800
> syzbot has found a reproducer for the following issue on:
>
> HEAD commit: d206a76d7d27 Linux 6.8-rc6
> git tree: upstream
> C reproducer: https://syzkaller.appspot.com/x/repro.c?x=1704b3e2180000

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

--- x/drivers/dma-buf/sync_debug.c
+++ y/drivers/dma-buf/sync_debug.c
@@ -107,15 +107,16 @@ static void sync_print_fence(struct seq_
static void sync_print_obj(struct seq_file *s, struct sync_timeline *obj)
{
struct list_head *pos;
+ unsigned long flags;

seq_printf(s, "%s: %d\n", obj->name, obj->value);

- spin_lock_irq(&obj->lock);
+ spin_lock_irqsave(&obj->lock, flags);
list_for_each(pos, &obj->pt_list) {
struct sync_pt *pt = container_of(pos, struct sync_pt, link);
sync_print_fence(s, &pt->base, false);
}
- spin_unlock_irq(&obj->lock);
+ spin_unlock_irqrestore(&obj->lock, flags);
}

static void sync_print_sync_file(struct seq_file *s,
--