We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 017fb83 commit 8270cb1Copy full SHA for 8270cb1
drivers/cdrom/cdrom.c
@@ -264,6 +264,7 @@
264
#include <linux/errno.h>
265
#include <linux/kernel.h>
266
#include <linux/mm.h>
267
+#include <linux/nospec.h>
268
#include <linux/slab.h>
269
#include <linux/cdrom.h>
270
#include <linux/sysctl.h>
@@ -2311,6 +2312,9 @@ static int cdrom_ioctl_media_changed(struct cdrom_device_info *cdi,
2311
2312
if (arg >= cdi->capacity)
2313
return -EINVAL;
2314
2315
+ /* Prevent arg from speculatively bypassing the length check */
2316
+ barrier_nospec();
2317
+
2318
info = kmalloc(sizeof(*info), GFP_KERNEL);
2319
if (!info)
2320
return -ENOMEM;
0 commit comments