[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <2023111333-duly-mobility-edc7@gregkh>
Date: Mon, 13 Nov 2023 13:33:48 -0500
From: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To: Tomas Mudrunka <tomas.mudrunka@...il.com>
Cc: Jiri Slaby <jirislaby@...nel.org>, linux-kernel@...r.kernel.org,
linux-serial@...r.kernel.org
Subject: Re: [PATCH] /proc/sysrq-trigger: accept multiple keys at once
On Mon, Nov 13, 2023 at 07:22:19PM +0100, Tomas Mudrunka wrote:
> Just for convenience.
> This way we can do:
> `echo reisub > /proc/sysrq-trigger`
> Instead of:
> `for i in r e i s u b; do echo "$i" > /proc/sysrq-trigger; done;`
>
> Signed-off-by: Tomas Mudrunka <tomas.mudrunka@...il.com>
> ---
> drivers/tty/sysrq.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/tty/sysrq.c b/drivers/tty/sysrq.c
> index 6b4a28bcf..bc5a679f6 100644
> --- a/drivers/tty/sysrq.c
> +++ b/drivers/tty/sysrq.c
> @@ -1154,10 +1154,12 @@ EXPORT_SYMBOL(unregister_sysrq_key);
> static ssize_t write_sysrq_trigger(struct file *file, const char __user *buf,
> size_t count, loff_t *ppos)
> {
> - if (count) {
> + size_t i;
> +
> + for (i = 0; i < count; i++) {
> char c;
>
> - if (get_user(c, buf))
> + if (get_user(c, buf+i))
What did you just break where people would send a string and only relied
on the first character being checked? This might not be ok to do.
Also, no documentation update?
thanks,
greg k-h
Powered by blists - more mailing lists