[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <tencent_941B48254CBA00BB4933069E391B6E4B5408@qq.com>
Date: Wed, 21 Feb 2024 22:20:05 +0800
From: Edward Adam Davis <eadavis@...com>
To: syzbot+116b65a23bc791ae49a6@...kaller.appspotmail.com
Cc: hverkuil-cisco@...all.nl,
linux-kernel@...r.kernel.org,
linux-media@...r.kernel.org,
mchehab@...nel.org,
syzkaller-bugs@...glegroups.com
Subject: [PATCH] media/cec/core: fix task hung in cec_claim_log_addrs
After unlocking adap->lock in cec_claim_log_addrs(), cec_claim_log_addrs() may
re-enter, causing this issue to occur.
In the thread function cec_config_thread_func() adap->lock is also used, so there
is no need to unlock adap->lock in cec_claim_log_addrs(), and then use adap->lock
in cec_config_thread_func() to protect.
Reported-and-tested-by: syzbot+116b65a23bc791ae49a6@...kaller.appspotmail.com
Signed-off-by: Edward Adam Davis <eadavis@...com>
---
drivers/media/cec/core/cec-adap.c | 5 -----
1 file changed, 5 deletions(-)
diff --git a/drivers/media/cec/core/cec-adap.c b/drivers/media/cec/core/cec-adap.c
index 5741adf09a2e..21b3ff504524 100644
--- a/drivers/media/cec/core/cec-adap.c
+++ b/drivers/media/cec/core/cec-adap.c
@@ -1436,7 +1436,6 @@ static int cec_config_thread_func(void *arg)
int err;
int i, j;
- mutex_lock(&adap->lock);
dprintk(1, "physical address: %x.%x.%x.%x, claim %d logical addresses\n",
cec_phys_addr_exp(adap->phys_addr), las->num_log_addrs);
las->log_addr_mask = 0;
@@ -1565,7 +1564,6 @@ static int cec_config_thread_func(void *arg)
}
adap->kthread_config = NULL;
complete(&adap->config_completion);
- mutex_unlock(&adap->lock);
call_void_op(adap, configured);
return 0;
@@ -1577,7 +1575,6 @@ static int cec_config_thread_func(void *arg)
adap->must_reconfigure = false;
adap->kthread_config = NULL;
complete(&adap->config_completion);
- mutex_unlock(&adap->lock);
return 0;
}
@@ -1602,9 +1599,7 @@ static void cec_claim_log_addrs(struct cec_adapter *adap, bool block)
adap->kthread_config = NULL;
adap->is_configuring = false;
} else if (block) {
- mutex_unlock(&adap->lock);
wait_for_completion(&adap->config_completion);
- mutex_lock(&adap->lock);
}
}
--
2.43.0
Powered by blists - more mailing lists