|
@@ -1566,6 +1566,14 @@ static int copy_params(struct dm_ioctl __user *user, struct dm_ioctl **param)
|
|
|
if (copy_from_user(dmi, user, tmp.data_size))
|
|
|
goto bad;
|
|
|
|
|
|
+ /*
|
|
|
+ * Abort if something changed the ioctl data while it was being copied.
|
|
|
+ */
|
|
|
+ if (dmi->data_size != tmp.data_size) {
|
|
|
+ DMERR("rejecting ioctl: data size modified while processing parameters");
|
|
|
+ goto bad;
|
|
|
+ }
|
|
|
+
|
|
|
/* Wipe the user buffer so we do not return it to userspace */
|
|
|
if (secure_data && clear_user(user, tmp.data_size))
|
|
|
goto bad;
|