]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
[media] dvb-core: prevent some corruption the legacy ioctl
authorDan Carpenter <dan.carpenter@oracle.com>
Sat, 6 Jun 2015 16:55:22 +0000 (13:55 -0300)
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>
Wed, 10 Jun 2015 14:47:56 +0000 (11:47 -0300)
Quite a few of the ->diseqc_send_master_cmd() implementations don't
check cmd->msg_len so it can lead to memory corruption.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
drivers/media/dvb-core/dvb_frontend.c

index b30ca59de04f8000c678057f8ea82b111fc47009..842b9c8f80c6d16362b0829957657aa362749cd3 100644 (file)
@@ -2384,7 +2384,13 @@ static int dvb_frontend_ioctl_legacy(struct file *file,
 
        case FE_DISEQC_SEND_MASTER_CMD:
                if (fe->ops.diseqc_send_master_cmd) {
-                       err = fe->ops.diseqc_send_master_cmd(fe, (struct dvb_diseqc_master_cmd*) parg);
+                       struct dvb_diseqc_master_cmd *cmd = parg;
+
+                       if (cmd->msg_len > sizeof(cmd->msg)) {
+                               err = -EINVAL;
+                               break;
+                       }
+                       err = fe->ops.diseqc_send_master_cmd(fe, cmd);
                        fepriv->state = FESTATE_DISEQC;
                        fepriv->status = 0;
                }