From: Defang Bo <bodefang@126.com>
To: mchehab@kernel.org, hverkuil-cisco@xs4all.nl
Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org,
Defang Bo <bodefang@126.com>
Subject: [PATCH] media: v4l2-compat-ioctl32: check for max size
Date: Mon, 19 Oct 2020 19:54:49 +0800 [thread overview]
Message-ID: <1603108489-4832-1-git-send-email-bodefang@126.com> (raw)
Similar to commit<ea72fbf588ac>("media: v4l2-compat-ioctl32: prevent go past max size"} ,add max size check for count variable.
Signed-off-by: Defang Bo <bodefang@126.com>
---
drivers/media/v4l2-core/v4l2-compat-ioctl32.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/media/v4l2-core/v4l2-compat-ioctl32.c b/drivers/media/v4l2-core/v4l2-compat-ioctl32.c
index a99e82e..5041d60 100644
--- a/drivers/media/v4l2-core/v4l2-compat-ioctl32.c
+++ b/drivers/media/v4l2-core/v4l2-compat-ioctl32.c
@@ -207,7 +207,7 @@ static int put_v4l2_window32(struct v4l2_window __user *p64,
get_user(clipcount, &p64->clipcount) ||
put_user(clipcount, &p32->clipcount))
return -EFAULT;
- if (!clipcount)
+ if (!clipcount || count > (U32_MAX/sizeof(*uclips)))
return 0;
if (get_user(kclips, &p64->clips))
--
1.9.1
next reply other threads:[~2020-10-19 11:55 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-19 11:54 Defang Bo [this message]
2020-10-30 10:32 ` Hans Verkuil
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=1603108489-4832-1-git-send-email-bodefang@126.com \
--to=bodefang@126.com \
--cc=hverkuil-cisco@xs4all.nl \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@kernel.org \
/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®