* [PATCH v5 01/02] tty: rocket: Remove RCPK_GET_STRUCT ioctl
@ 2019-04-18 4:35 Fuqian Huang
2019-04-18 4:35 ` [PATCH v5 02/02] tty: rocket: deprecate the rp_ioctl Fuqian Huang
0 siblings, 1 reply; 3+ messages in thread
From: Fuqian Huang @ 2019-04-18 4:35 UTC (permalink / raw)
Cc: Fuqian Huang, Greg Kroah-Hartman, Jiri Slaby, linux-kernel
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 <huangfq.daxian@gmail.com>
---
drivers/tty/rocket.c | 4 ----
drivers/tty/rocket.h | 1 -
2 files changed, 5 deletions(-)
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;
diff --git a/drivers/tty/rocket.h b/drivers/tty/rocket.h
index d0560203f215..d62ed6587f32 100644
--- a/drivers/tty/rocket.h
+++ b/drivers/tty/rocket.h
@@ -71,7 +71,6 @@ struct rocket_version {
/*
* Rocketport ioctls -- "RP"
*/
-#define RCKP_GET_STRUCT 0x00525001
#define RCKP_GET_CONFIG 0x00525002
#define RCKP_SET_CONFIG 0x00525003
#define RCKP_GET_PORTS 0x00525004
--
2.11.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH v5 02/02] tty: rocket: deprecate the rp_ioctl
2019-04-18 4:35 [PATCH v5 01/02] tty: rocket: Remove RCPK_GET_STRUCT ioctl Fuqian Huang
@ 2019-04-18 4:35 ` Fuqian Huang
2019-04-18 6:59 ` Greg Kroah-Hartman
0 siblings, 1 reply; 3+ messages in thread
From: Fuqian Huang @ 2019-04-18 4:35 UTC (permalink / raw)
Cc: Fuqian Huang, Greg Kroah-Hartman, Jiri Slaby, linux-kernel
This patch depends on patch 01.
The rp_ioctl is deprecated.
Add dev_warn_ratelimited to warn the use of rp_ioctl.
Signed-off-by: Fuqian Huang <huangfq.daxian@gmail.com>
---
drivers/tty/rocket.c | 10 ++++++++++
1 file changed, 10 insertions(+)
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:
--
2.11.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v5 02/02] tty: rocket: deprecate the rp_ioctl
2019-04-18 4:35 ` [PATCH v5 02/02] tty: rocket: deprecate the rp_ioctl Fuqian Huang
@ 2019-04-18 6:59 ` Greg Kroah-Hartman
0 siblings, 0 replies; 3+ messages in thread
From: Greg Kroah-Hartman @ 2019-04-18 6:59 UTC (permalink / raw)
To: Fuqian Huang; +Cc: Jiri Slaby, linux-kernel
On Thu, Apr 18, 2019 at 12:35:58PM +0800, Fuqian Huang wrote:
> This patch depends on patch 01.
THat's implied as it is patch 02/02, so no need to put it in the
changelog text :)
>
> The rp_ioctl is deprecated.
> Add dev_warn_ratelimited to warn the use of rp_ioctl.
>
> Signed-off-by: Fuqian Huang <huangfq.daxian@gmail.com>
> ---
> drivers/tty/rocket.c | 10 ++++++++++
> 1 file changed, 10 insertions(+)
>
> 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");
Nit, you can wrap this a bit nicer to make checkpatch.pl happy:
dev_warn_ratelimited(tty->dev,
"RCKP_GET_CONFIG option is deprecated\n");
I'll fix it up when I apply it, thanks!
greg k-h
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-04-18 6:59 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-18 4:35 [PATCH v5 01/02] tty: rocket: Remove RCPK_GET_STRUCT ioctl Fuqian Huang
2019-04-18 4:35 ` [PATCH v5 02/02] tty: rocket: deprecate the rp_ioctl Fuqian Huang
2019-04-18 6:59 ` Greg Kroah-Hartman
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.