* re: mfd: cros_ec: Use a zero-length array for command data
@ 2015-06-23 13:41 Dan Carpenter
0 siblings, 0 replies; only message in thread
From: Dan Carpenter @ 2015-06-23 13:41 UTC (permalink / raw)
To: kernel-janitors
Hello Javier Martinez Canillas,
The patch a841178445bb: "mfd: cros_ec: Use a zero-length array for
command data" from Jun 9, 2015, has memory corruption issues.
drivers/platform/chrome/cros_ec_dev.c
130 static long ec_device_ioctl_xcmd(struct cros_ec_dev *ec, void __user *arg)
131 {
132 long ret;
133 struct cros_ec_command u_cmd;
134 struct cros_ec_command *s_cmd;
135
136 if (copy_from_user(&u_cmd, arg, sizeof(u_cmd)))
137 return -EFAULT;
138
139 s_cmd = kmalloc(sizeof(*s_cmd) + max(u_cmd.outsize, u_cmd.insize),
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
This can integer overflow on 32 bit systems leading to a smaller s_cmd
than intended.
140 GFP_KERNEL);
141 if (!s_cmd)
142 return -ENOMEM;
143
144 if (copy_from_user(s_cmd, arg, sizeof(*s_cmd) + u_cmd.outsize)) {
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Memory corruption.
145 ret = -EFAULT;
146 goto exit;
147 }
148
regards,
dan carpenter
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2015-06-23 13:41 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-06-23 13:41 mfd: cros_ec: Use a zero-length array for command data Dan Carpenter
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox