aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@s-opensource.com>2018-03-23 07:51:07 -0400
committerMauro Carvalho Chehab <mchehab@s-opensource.com>2018-03-23 08:37:22 -0400
commit98c1ce0ccff1617cba45e8ead236768a50545e7f (patch)
treeb92ef1d6c8f29462d4fa2a083a4038f18c5a7999 /drivers/media
parentmedia: tda9840: cleanup a warning (diff)
downloadlinux-dev-98c1ce0ccff1617cba45e8ead236768a50545e7f.tar.xz
linux-dev-98c1ce0ccff1617cba45e8ead236768a50545e7f.zip
media: cec-core: fix a bug at cec_error_inj_write()
If the adapter doesn't have error_inj_parse_line() ops, the write() logic won't return -EINVAL, but, instead, it will keep looping, because "count" is a non-negative number. Reviewed-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Diffstat (limited to 'drivers/media')
-rw-r--r--drivers/media/cec/cec-core.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/media/cec/cec-core.c b/drivers/media/cec/cec-core.c
index ea3eccfdba15..b0c87f9ea08f 100644
--- a/drivers/media/cec/cec-core.c
+++ b/drivers/media/cec/cec-core.c
@@ -209,14 +209,14 @@ static ssize_t cec_error_inj_write(struct file *file,
if (IS_ERR(buf))
return PTR_ERR(buf);
p = buf;
- while (p && *p && count >= 0) {
+ while (p && *p) {
p = skip_spaces(p);
line = strsep(&p, "\n");
if (!*line || *line == '#')
continue;
if (!adap->ops->error_inj_parse_line(adap, line)) {
- count = -EINVAL;
- break;
+ kfree(buf);
+ return -EINVAL;
}
}
kfree(buf);