mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] s390/3270: return -ENOTTY for unknown ioctls in fs3270_ioctl()
@ 2026-10-05  5:58 Shirong Zhao
  2026-10-05  8:38 ` Heiko Carstens
  0 siblings, 1 reply; 2+ messages in thread
From: Shirong Zhao @ 2026-10-05  5:58 UTC (permalink / raw)
  To: Heiko Carstens, Vasily Gorbik, Alexander Gordeev,
	Christian Borntraeger, Sven Schnelle
  Cc: linux-s390, linux-kernel

fs3270_ioctl() initializes rc to 0 and its cmd switch has no default
branch, so an unrecognized ioctl command returns success without doing
anything. Follow the ioctl convention and reject unknown commands with
-ENOTTY.

Verified against Linux 7.3-rc6 (a90ee4305c4a5df72c11b31dacfdc76e00fcf78a),
the current mainline master: rc is initialised to 0, the switch covers
TUBICMD, TUBOCMD, TUBGETI, TUBGETO and TUBGETMOD only and has no default
branch, so an unknown command returns success without doing anything. The
file is byte-identical between 7.3-rc5 and 7.3-rc6.

Sibling audit (same snapshot, all NOT bugs -- do not re-report):
- drivers/s390/char/keyboard.c:kbd_ioctl HAS default -> -ENOIOCTLCMD;
  do_kdsk/do_kdgkb lack default but only reachable via whitelisted
  cmds from kbd_ioctl, harmless.
- drivers/char/nvram.c:nvram_misc_ioctl inits ret=-ENOTTY, safe.
- drivers/misc/tps6594-pfsm.c inits ret=-ENOIOCTLCMD, safe.
- drivers/misc/pci_endpoint_test.c inits ret=-EINVAL, safe (error).
Only fs3270 inits 0 -> true positive.

Signed-off-by: Shirong Zhao <shxzhaosr@163.com>
---
 drivers/s390/char/fs3270.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/s390/char/fs3270.c b/drivers/s390/char/fs3270.c
--- a/drivers/s390/char/fs3270.c
+++ b/drivers/s390/char/fs3270.c
@@ -358,6 +358,9 @@ static long fs3270_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
 		if (copy_to_user(argp, &iocb, sizeof(struct raw3270_iocb)))
 			rc = -EFAULT;
 		break;
+	default:
+		rc = -ENOTTY;
+		break;
 	}
 	mutex_unlock(&fs3270_mutex);
 	return rc;


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] s390/3270: return -ENOTTY for unknown ioctls in fs3270_ioctl()
  2026-10-05  5:58 [PATCH] s390/3270: return -ENOTTY for unknown ioctls in fs3270_ioctl() Shirong Zhao
@ 2026-10-05  8:38 ` Heiko Carstens
  0 siblings, 0 replies; 2+ messages in thread
From: Heiko Carstens @ 2026-10-05  8:38 UTC (permalink / raw)
  To: Shirong Zhao
  Cc: Vasily Gorbik, Alexander Gordeev, Christian Borntraeger,
	Sven Schnelle, linux-s390, linux-kernel

On Mon, Oct 05, 2026 at 01:58:25PM +0800, Shirong Zhao wrote:
> fs3270_ioctl() initializes rc to 0 and its cmd switch has no default
> branch, so an unrecognized ioctl command returns success without doing
> anything. Follow the ioctl convention and reject unknown commands with
> -ENOTTY.
...
> Signed-off-by: Shirong Zhao <shxzhaosr@163.com>
> ---
>  drivers/s390/char/fs3270.c | 3 +++
>  1 file changed, 3 insertions(+)

Applied, thanks!

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-10-05  8:38 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-05  5:58 [PATCH] s390/3270: return -ENOTTY for unknown ioctls in fs3270_ioctl() Shirong Zhao
2026-10-05  8:38 ` Heiko Carstens

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®