From: Myungho Jung <mhjungk@gmail.com>
To: pawel@osciak.com, m.szyprowski@samsung.com,
kyungmin.park@samsung.com, mchehab@kernel.org
Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH] media: videobuf2-core: Fix error handling when fileio is deallocated
Date: Sun, 11 Nov 2018 16:49:53 -0800 [thread overview]
Message-ID: <20181112004951.GA3948@myunghoj-Precision-5530> (raw)
The mutex that is held from vb2_fop_read() can be unlocked while waiting
for a buffer if the queue is streaming and blocking. Meanwhile, fileio
can be released. So, it should return an error if the fileio address is
changed.
Signed-off-by: Myungho Jung <mhjungk@gmail.com>
Reported-by: syzbot+4180ff9ca6810b06c1e9@syzkaller.appspotmail.com
---
drivers/media/common/videobuf2/videobuf2-core.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/media/common/videobuf2/videobuf2-core.c b/drivers/media/common/videobuf2/videobuf2-core.c
index 975ff5669f72..bff94752eb27 100644
--- a/drivers/media/common/videobuf2/videobuf2-core.c
+++ b/drivers/media/common/videobuf2/videobuf2-core.c
@@ -2564,6 +2564,10 @@ static size_t __vb2_perform_fileio(struct vb2_queue *q, char __user *data, size_
dprintk(5, "vb2_dqbuf result: %d\n", ret);
if (ret)
return ret;
+ if (fileio != q->fileio) {
+ dprintk(3, "fileio deallocated\n");
+ return -EFAULT;
+ }
fileio->dq_count += 1;
fileio->cur_index = index;
--
2.17.1
next reply other threads:[~2018-11-12 0:49 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CGME20181112005053epcas4p1c674759797b4a930cfcce3abc7edd9ad@epcas4p1.samsung.com>
2018-11-12 0:49 ` Myungho Jung [this message]
2018-11-13 10:27 ` Marek Szyprowski
2018-11-13 11:56 ` Hans Verkuil
2018-11-13 17:38 ` Myungho Jung
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=20181112004951.GA3948@myunghoj-Precision-5530 \
--to=mhjungk@gmail.com \
--cc=kyungmin.park@samsung.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=m.szyprowski@samsung.com \
--cc=mchehab@kernel.org \
--cc=pawel@osciak.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
all inboxes | Powered by JetHome®