From: Guenter Roeck <linux@roeck-us.net>
To: "Michael S. Tsirkin" <mst@redhat.com>, linux-kernel@vger.kernel.org
Cc: stable@vger.kernel.org, Wim Van Sebroeck <wim@iguana.be>,
linux-watchdog@vger.kernel.org,
Dan Carpenter <dan.carpenter@oracle.com>
Subject: Re: [PATCH for-4.5] watchdog/rc32434_wdt: fix ioctl error handling
Date: Sun, 28 Feb 2016 07:56:55 -0800 [thread overview]
Message-ID: <56D318C7.8070800@roeck-us.net> (raw)
In-Reply-To: <1456674185-24670-1-git-send-email-mst@redhat.com>
On 02/28/2016 07:44 AM, Michael S. Tsirkin wrote:
> Calling return copy_to_user(...) in an ioctl will not do the right thing
> if there's a pagefault: copy_to_user returns the number of bytes not
> copied in this case.
>
> Fix up watchdog/rc32434_wdt to do
> return copy_to_user(...)) ? -EFAULT : 0;
>
> instead.
>
> Cc: stable@vger.kernel.org
> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Acked-by: Guenter Roeck <linux@roeck-us.net>
> ---
>
> Untested.
>
> drivers/watchdog/rc32434_wdt.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/watchdog/rc32434_wdt.c b/drivers/watchdog/rc32434_wdt.c
> index 71e78ef..3a75f3b 100644
> --- a/drivers/watchdog/rc32434_wdt.c
> +++ b/drivers/watchdog/rc32434_wdt.c
> @@ -237,7 +237,7 @@ static long rc32434_wdt_ioctl(struct file *file, unsigned int cmd,
> return -EINVAL;
> /* Fall through */
> case WDIOC_GETTIMEOUT:
> - return copy_to_user(argp, &timeout, sizeof(int));
> + return copy_to_user(argp, &timeout, sizeof(int)) ? -EFAULT : 0;
> default:
> return -ENOTTY;
> }
>
next prev parent reply other threads:[~2016-02-28 15:56 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-28 15:44 [PATCH for-4.5] watchdog/rc32434_wdt: fix ioctl error handling Michael S. Tsirkin
2016-02-28 15:56 ` Guenter Roeck [this message]
2016-03-04 19:39 ` Wim Van Sebroeck
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=56D318C7.8070800@roeck-us.net \
--to=linux@roeck-us.net \
--cc=dan.carpenter@oracle.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-watchdog@vger.kernel.org \
--cc=mst@redhat.com \
--cc=stable@vger.kernel.org \
--cc=wim@iguana.be \
/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;
as well as URLs for NNTP newsgroup(s).