Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1736192 > unrolled thread

[PATCH] media: dvb_ca_en50221: sanity check slot number from userspace

Started byColin King <colin.king@canonical.com>
First post2017-09-21 00:30 +0200
Last post2017-09-21 02:00 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] media: dvb_ca_en50221: sanity check slot number from userspace Colin King <colin.king@canonical.com> - 2017-09-21 00:30 +0200
    Re: [PATCH] media: dvb_ca_en50221: sanity check slot number from  userspace Dan Carpenter <dan.carpenter@oracle.com> - 2017-09-21 02:00 +0200

#1736192 — [PATCH] media: dvb_ca_en50221: sanity check slot number from userspace

FromColin King <colin.king@canonical.com>
Date2017-09-21 00:30 +0200
Subject[PATCH] media: dvb_ca_en50221: sanity check slot number from userspace
Message-ID<urVFf-FH-5@gated-at.bofh.it>
From: Colin Ian King <colin.king@canonical.com>

Currently a user can pass in an unsanitized slot number which
will lead to and out of range index into ca->slot_info. Fix this
by checking that the slot number is no more than the allowed
maximum number of slots. Seems that this bug has been in the driver
forever.

Detected by CoverityScan, CID#139381 ("Untrusted pointer read")

Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 drivers/media/dvb-core/dvb_ca_en50221.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/media/dvb-core/dvb_ca_en50221.c b/drivers/media/dvb-core/dvb_ca_en50221.c
index 95b3723282f4..e3a92b529dba 100644
--- a/drivers/media/dvb-core/dvb_ca_en50221.c
+++ b/drivers/media/dvb-core/dvb_ca_en50221.c
@@ -1474,6 +1474,9 @@ static ssize_t dvb_ca_en50221_io_write(struct file *file,
 		return -EFAULT;
 	buf += 2;
 	count -= 2;
+
+	if (slot >= ca->slot_count)
+		return -EINVAL;
 	sl = &ca->slot_info[slot];
 
 	/* check if the slot is actually running */
-- 
2.14.1

[toc] | [next] | [standalone]


#1736272 — Re: [PATCH] media: dvb_ca_en50221: sanity check slot number from userspace

FromDan Carpenter <dan.carpenter@oracle.com>
Date2017-09-21 02:00 +0200
SubjectRe: [PATCH] media: dvb_ca_en50221: sanity check slot number from userspace
Message-ID<urX4l-1rm-5@gated-at.bofh.it>
In reply to#1736192
Looks good.

Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>

regards,
dan carpenter

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web