From 29973f8a88b001ebc605c88cdee124f7256ecdbf Mon Sep 17 00:00:00 2001 From: Fuqian Huang Date: Thu, 18 Apr 2019 12:35:57 +0800 Subject: tty: rocket: Remove RCPK_GET_STRUCT ioctl If the cmd is RCPK_GET_STRUCT, copy_to_user will copy info to user space. As info->port.ops is the address of a constant object rocket_port_ops (assigned in init_r_port), a kernel address leakage happens. Remove the RCPK_GET_STRUCT ioctl. Signed-off-by: Fuqian Huang Signed-off-by: Greg Kroah-Hartman --- drivers/tty/rocket.c | 4 ---- 1 file changed, 4 deletions(-) (limited to 'drivers/tty/rocket.c') diff --git a/drivers/tty/rocket.c b/drivers/tty/rocket.c index b121d8f8f3d7..b6543e28bd8b 100644 --- a/drivers/tty/rocket.c +++ b/drivers/tty/rocket.c @@ -1283,10 +1283,6 @@ static int rp_ioctl(struct tty_struct *tty, return -ENXIO; switch (cmd) { - case RCKP_GET_STRUCT: - if (copy_to_user(argp, info, sizeof (struct r_port))) - ret = -EFAULT; - break; case RCKP_GET_CONFIG: ret = get_config(info, argp); break; -- cgit v1.2.3-58-ga151 From 8ef795653d753e3d6ae67e6f4a0168ff3c059deb Mon Sep 17 00:00:00 2001 From: Fuqian Huang Date: Thu, 18 Apr 2019 12:35:58 +0800 Subject: tty: rocket: deprecate the rp_ioctl The rp_ioctl is deprecated. Add dev_warn_ratelimited to warn the use of rp_ioctl. Signed-off-by: Fuqian Huang Signed-off-by: Greg Kroah-Hartman --- drivers/tty/rocket.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'drivers/tty/rocket.c') diff --git a/drivers/tty/rocket.c b/drivers/tty/rocket.c index b6543e28bd8b..1e1bcb54b680 100644 --- a/drivers/tty/rocket.c +++ b/drivers/tty/rocket.c @@ -1284,18 +1284,28 @@ static int rp_ioctl(struct tty_struct *tty, switch (cmd) { case RCKP_GET_CONFIG: + dev_warn_ratelimited(tty->dev, + "RCKP_GET_CONFIG option is deprecated\n"); ret = get_config(info, argp); break; case RCKP_SET_CONFIG: + dev_warn_ratelimited(tty->dev, + "RCKP_SET_CONFIG option is deprecated\n"); ret = set_config(tty, info, argp); break; case RCKP_GET_PORTS: + dev_warn_ratelimited(tty->dev, + "RCKP_GET_PORTS option is deprecated\n"); ret = get_ports(info, argp); break; case RCKP_RESET_RM2: + dev_warn_ratelimited(tty->dev, + "RCKP_RESET_RM2 option is deprecated\n"); ret = reset_rm2(info, argp); break; case RCKP_GET_VERSION: + dev_warn_ratelimited(tty->dev, + "RCKP_GET_VERSION option is deprecated\n"); ret = get_version(info, argp); break; default: -- cgit v1.2.3-58-ga151