Skip to contentSkip to conversation

random: don't forget compat_ioctl on unrandom

PATCH In review Jason A. Donenfeld 3 participants 4 messages Dec 17, 2019 Random number driver

lore
Share & tools
lore

Jason A. Donenfeld

author maintainer
#0 lore raw

PATCH 1/1 random: don't forget compat_ioctl on unrandom

Recently, there's been some compat ioctl cleanup, in which large hardcoded lists were replaced with compat_ptr_ioctl. One of these changes involved removing the random.c hardcoded list entries and adding a compat ioctl function pointer to the random.c fops. In the process, urandom was forgotten about, so this commit fixes that oversight.

Fixes 507e4e2b430b ("compat_ioctl: remove /dev/random commands")
Cc Arnd Bergmann <[email protected]>
Cc Greg Kroah-Hartman <[email protected]>
---
 drivers/char/random.c | 1 +
 1 file changed, 1 insertion(+)
drivers/char/random.c +1 -0
index 909e0c3d82ea..cda12933a17d 100644
@@ -2175,6 +2175,7 @@ const struct file_operations urandom_fops = {
 	.read  = urandom_read,
 	.write = random_write,
 	.unlocked_ioctl = random_ioctl,
+	.compat_ioctl = compat_ptr_ioctl,
 	.fasync = random_fasync,
 	.llseek = noop_llseek,
 };
Signature · 1 line
2.24.1
author maintainer
#1 lore raw

Ooof, typing too fast. "unrandom" in the subject should be "urandom", of course.

Quoted 29 lines · Jason A. Donenfeld

Recently, there's been some compat ioctl cleanup, in which large hardcoded lists were replaced with compat_ptr_ioctl. One of these changes involved removing the random.c hardcoded list entries and adding a compat ioctl function pointer to the random.c fops. In the process, urandom was forgotten about, so this commit fixes that oversight.

Fixes 507e4e2b430b ("compat_ioctl: remove /dev/random commands")
Cc Arnd Bergmann <[email protected]>
Cc Greg Kroah-Hartman <[email protected]>
---
 drivers/char/random.c | 1 +
 1 file changed, 1 insertion(+)
drivers/char/random.c +1 -1
index 909e0c3d82ea..cda12933a17d 100644
@@ -2175,6 +2175,7 @@ const struct file_operations urandom_fops = {
        .read  = urandom_read,
        .write = random_write,
        .unlocked_ioctl = random_ioctl,
+       .compat_ioctl = compat_ptr_ioctl,
        .fasync = random_fasync,
        .llseek = noop_llseek,
 };
--

2.24.1

#2 lore raw
In reply to Jason A. Donenfeld
Quoted 11 lines · Jason A. Donenfeld

Recently, there's been some compat ioctl cleanup, in which large hardcoded lists were replaced with compat_ptr_ioctl. One of these changes involved removing the random.c hardcoded list entries and adding a compat ioctl function pointer to the random.c fops. In the process, urandom was forgotten about, so this commit fixes that oversight.

Fixes 507e4e2b430b ("compat_ioctl: remove /dev/random commands")
Cc Arnd Bergmann <[email protected]>
Cc Greg Kroah-Hartman <[email protected]>

Thanks for debugging this. I had already sent the same patch a few days ago after the first report:

https://lore.kernel.org/lkml/[email protected]/

Greg, can you please apply one of these and send it to Linus for 5.5-rc3?

Arnd

Quoted 19 lines
---
 drivers/char/random.c | 1 +
 1 file changed, 1 insertion(+)
drivers/char/random.c +1 -1
index 909e0c3d82ea..cda12933a17d 100644
@@ -2175,6 +2175,7 @@ const struct file_operations urandom_fops = {
        .read  = urandom_read,
        .write = random_write,
        .unlocked_ioctl = random_ioctl,
+       .compat_ioctl = compat_ptr_ioctl,
        .fasync = random_fasync,
        .llseek = noop_llseek,
 };
--

2.24.1

#3 lore raw
Quoted 13 lines · Arnd Bergmann
Quoted 11 lines · Jason A. Donenfeld

Recently, there's been some compat ioctl cleanup, in which large hardcoded lists were replaced with compat_ptr_ioctl. One of these changes involved removing the random.c hardcoded list entries and adding a compat ioctl function pointer to the random.c fops. In the process, urandom was forgotten about, so this commit fixes that oversight.

Fixes 507e4e2b430b ("compat_ioctl: remove /dev/random commands")
Cc Arnd Bergmann <[email protected]>
Cc Greg Kroah-Hartman <[email protected]>
Quoted 6 lines

Thanks for debugging this. I had already sent the same patch a few days ago after the first report:

https://lore.kernel.org/lkml/[email protected]/

Greg, can you please apply one of these and send it to Linus for 5.5-rc3?

Ugh, I missed your first one, sorry, I thought that was for Ted and missed that it was due to a patch that came from my tree. I've queued Jason's patch up now.

thanks,

greg k-h