projects
/
openwrt
/
staging
/
blogic.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
7b6c96d
)
media: dvb_vb2: limit reqbufs size to a sane value
author
Mauro Carvalho Chehab
<
[email protected]
>
Thu, 28 Dec 2017 12:11:40 +0000
(07:11 -0500)
committer
Mauro Carvalho Chehab
<
[email protected]
>
Thu, 28 Dec 2017 16:17:27 +0000
(11:17 -0500)
It is not a good idea to let users to request a very high buffer
size.
So, add an upper limit.
Signed-off-by: Mauro Carvalho Chehab <
[email protected]
>
drivers/media/dvb-core/dvb_vb2.c
patch
|
blob
|
history
diff --git
a/drivers/media/dvb-core/dvb_vb2.c
b/drivers/media/dvb-core/dvb_vb2.c
index 36313387d8b20cc8a454c02cebceb2fef751111c..4223d33c60dc1b695dabcb51d66912680b694f33 100644
(file)
--- a/
drivers/media/dvb-core/dvb_vb2.c
+++ b/
drivers/media/dvb-core/dvb_vb2.c
@@
-18,6
+18,8
@@
#include "dvbdev.h"
#include "dvb_vb2.h"
+#define DVB_V2_MAX_SIZE (4096 * 188)
+
static int vb2_debug;
module_param(vb2_debug, int, 0644);
@@
-330,6
+332,12
@@
int dvb_vb2_reqbufs(struct dvb_vb2_ctx *ctx, struct dmx_requestbuffers *req)
{
int ret;
+ /* Adjust size to a sane value */
+ if (req->size > DVB_V2_MAX_SIZE)
+ req->size = DVB_V2_MAX_SIZE;
+
+ /* FIXME: round req->size to a 188 or 204 multiple */
+
ctx->buf_siz = req->size;
ctx->buf_cnt = req->count;
ret = vb2_core_reqbufs(&ctx->vb_q, VB2_MEMORY_MMAP, &req->count);