ioctl DVD_READ_STRUCT fails for DVD_STRUCT_MANUFACT, causing some games to not detect their dvd?
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Linux |
Fix Released
|
Medium
|
|||
linux (Ubuntu) |
Fix Released
|
Undecided
|
Unassigned |
Bug Description
In the test program
#include <fcntl.h>
#include <stdio.h>
#include <string.h>
#include <sys/ioctl.h>
#include <linux/cdrom.h>
main(int argc, char *argv[])
{
dvd_struct buf;
int fd;
fd = open("/dev/sr0", O_RDONLY);
if (fd < 0) {
return -1;
}
memset(&buf, 0, sizeof(buf));
buf.type = DVD_STRUCT_
if (ioctl(fd, DVD_READ_STRUCT, &buf) < 0) {
return -2;
}
printf("Got len %d, value '%*s'\n", buf.manufact.len,
return 0;
}
the ioctl always fails with EIO. The test code seems too simple to be wrong,
so perhaps something is fishy in dvd_read_manufact() in the kernel,
http://
I care about this because this affects some games which are just trying
to verify that their DVD is inserted.
Rumor has it that the change
- if (s->manufact.len < 0 || s->manufact.len > 2048) {
+ if (s->manufact.len < 0 || s->manufact.len > 2052) {
cdinfo(
" (%d)\n", s->manufact.len);
ret = -EIO;
} else {
- memcpy(
+ memcpy(
+ s->manufact.len > 2052 ? 2048 : s->manufact.len);
makes the ioctl function as expected, and lets the games detect
their dvd.
Changed in linux: | |
importance: | Unknown → Medium |
status: | Unknown → Fix Released |
Do you have an upstream version of this bug?