Linux MIPS Architecture development
 help / color / mirror / Atom feed
From: Ralf Baechle <ralf@linux-mips.org>
To: Yoichi Yuasa <yoichi_yuasa@tripeaks.co.jp>
Cc: linux-mips <linux-mips@linux-mips.org>
Subject: Re: [PATCH][MIPS] add return value check to user_termio_to_kernel_termios()
Date: Wed, 28 Jan 2009 12:40:47 +0000	[thread overview]
Message-ID: <20090128124047.GA25706@linux-mips.org> (raw)
In-Reply-To: <20090125224557.8582051b.yoichi_yuasa@tripeaks.co.jp>

On Sun, Jan 25, 2009 at 10:45:57PM +0900, Yoichi Yuasa wrote:

> diff -pruN -X /home/yuasa/Memo/dontdiff linux-orig/arch/mips/include/asm/termios.h linux/arch/mips/include/asm/termios.h
> --- linux-orig/arch/mips/include/asm/termios.h	2008-10-19 22:33:14.114377349 +0900
> +++ linux/arch/mips/include/asm/termios.h	2008-10-19 22:41:25.322369698 +0900
> @@ -97,14 +97,14 @@ struct termio {
>  #define user_termio_to_kernel_termios(termios, termio) \
>  ({ \
>  	unsigned short tmp; \
> -	get_user(tmp, &(termio)->c_iflag); \
> -	(termios)->c_iflag = (0xffff0000 & ((termios)->c_iflag)) | tmp; \
> -	get_user(tmp, &(termio)->c_oflag); \
> -	(termios)->c_oflag = (0xffff0000 & ((termios)->c_oflag)) | tmp; \
> -	get_user(tmp, &(termio)->c_cflag); \
> -	(termios)->c_cflag = (0xffff0000 & ((termios)->c_cflag)) | tmp; \
> -	get_user(tmp, &(termio)->c_lflag); \
> -	(termios)->c_lflag = (0xffff0000 & ((termios)->c_lflag)) | tmp; \
> +	if (!get_user(tmp, &(termio)->c_iflag)) \
> +		(termios)->c_iflag = (0xffff0000 & ((termios)->c_iflag)) | tmp; \
> +	if (!get_user(tmp, &(termio)->c_oflag)) \
> +		(termios)->c_oflag = (0xffff0000 & ((termios)->c_oflag)) | tmp; \
> +	if (!get_user(tmp, &(termio)->c_cflag)) \
> +		(termios)->c_cflag = (0xffff0000 & ((termios)->c_cflag)) | tmp; \
> +	if (!get_user(tmp, &(termio)->c_lflag)) \
> +		(termios)->c_lflag = (0xffff0000 & ((termios)->c_lflag)) | tmp; \
>  	get_user((termios)->c_line, &(termio)->c_line); \
>  	copy_from_user((termios)->c_cc, (termio)->c_cc, NCC); \

Duh...  That sort of trivial thing is not fatal but just shouldn't
happen.  And other architectures have the same bug even.  Your patch
leaves the last get_user and the copy_from_user return values unchecked.
I'll sort that out.

Thanks for reporting and patch!

  Ralf

  reply	other threads:[~2009-01-28 12:40 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-25 13:45 [PATCH][MIPS] add return value check to user_termio_to_kernel_termios() Yoichi Yuasa
2009-01-28 12:40 ` Ralf Baechle [this message]
2009-01-28 13:40   ` Ralf Baechle
2009-01-29 12:00     ` Yoichi Yuasa

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090128124047.GA25706@linux-mips.org \
    --to=ralf@linux-mips.org \
    --cc=linux-mips@linux-mips.org \
    --cc=yoichi_yuasa@tripeaks.co.jp \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox