From: Łukasz Stelmach Date: Mon, 24 Jan 2022 13:53:39 +0000 (+0100) Subject: WIP: fix log->mutex + misc_mtx ab-ba deadlock X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fheads%2Fsandbox%2Flstelmach%2Fdeadlock;p=platform%2Fkernel%2Flinux-tizen-modules-source.git WIP: fix log->mutex + misc_mtx ab-ba deadlock Change-Id: Ibaab2947638997dca82c0e47146f77ce0f1bee57 Signed-off-by: Łukasz Stelmach --- diff --git a/kernel/logger.c b/kernel/logger.c index 8b2cda9..cf5dd8a 100644 --- a/kernel/logger.c +++ b/kernel/logger.c @@ -689,11 +689,12 @@ static ssize_t logger_aio_write(struct kiocb *iocb, const struct iovec *iov, if (writer->owner != current->group_leader) { struct file *nfile; + mutex_unlock(&log->mutex); nfile = make_new_file(file); if (IS_ERR(nfile)) { - mutex_unlock(&log->mutex); return PTR_ERR(nfile); } + mutex_lock(&log->mutex); file = nfile; writer = file->private_data; @@ -874,11 +875,12 @@ static ssize_t logger_write_iter(struct kiocb *iocb, struct iov_iter *from) if (writer->owner != current->group_leader) { struct file *nfile; + mutex_unlock(&log->mutex); nfile = make_new_file(file); if (IS_ERR(nfile)) { - mutex_unlock(&log->mutex); return PTR_ERR(nfile); } + mutex_lock(&log->mutex); file = nfile; writer = file->private_data;