mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Wim Van Sebroeck <wim@iguana.be>
To: "Michael S. Tsirkin" <mst@redhat.com>
Cc: linux-kernel@vger.kernel.org, stable@vger.kernel.org,
	Guenter Roeck <linux@roeck-us.net>,
	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: Fri, 4 Mar 2016 20:39:41 +0100	[thread overview]
Message-ID: <20160304193941.GF6900@spo001.leaseweb.nl> (raw)
In-Reply-To: <1456674185-24670-1-git-send-email-mst@redhat.com>

Hi Michael,

> 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>
> ---
> 
> 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;
>  	}
> -- 
> MST

Patch has been added to linux-watchdog-next.

Kind regards,
Wim.

      parent reply	other threads:[~2016-03-04 19:39 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-28 15:44 Michael S. Tsirkin
2016-02-28 15:56 ` Guenter Roeck
2016-03-04 19:39 ` Wim Van Sebroeck [this message]

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=20160304193941.GF6900@spo001.leaseweb.nl \
    --to=wim@iguana.be \
    --cc=dan.carpenter@oracle.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-watchdog@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=mst@redhat.com \
    --cc=stable@vger.kernel.org \
    /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

all inboxes | Powered by JetHome®