lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4E144F82.8060300@mvista.com>
Date:	Wed, 06 Jul 2011 16:05:22 +0400
From:	Sergei Shtylyov <sshtylyov@...sta.com>
To:	Vitaly Kuzmichev <vkuzmichev@...sta.com>
CC:	linux-arm-kernel@...ts.infradead.org,
	linux-watchdog@...r.kernel.org,
	Russell King <linux@....linux.org.uk>,
	Marc Zyngier <marc.zyngier@....com>,
	Wim Van Sebroeck <wim@...ana.be>,
	Arnd Bergmann <arnd@...db.de>,
	Nicolas Pitre <nico@...xnic.net>,
	John Stultz <johnstul@...ibm.com>,
	linux-kernel@...r.kernel.org, arm@...nel.org,
	Thomas Gleixner <tglx@...utronix.de>
Subject: Re: [PATCH V2 3/6] mpcore_wdt: Fix WDIOC_SETOPTIONS handling

Hello.

On 05-07-2011 23:00, Vitaly Kuzmichev wrote:

> According to the include/linux/watchdog.h WDIOC_SETOPTIONS is
> classified as 'read from device' ioctl call:
>    #define WDIOC_SETOPTIONS        _IOR(WATCHDOG_IOCTL_BASE, 4, int)

> However, the driver 'mpcore_wdt' performs 'copy_from_user' only if
> _IOC_WRITE is set, thus the local variable 'uarg' which is used in
> WDIOC_SETOPTIONS handling remains uninitialized.

> The proper way to fix this is to bind WDIOC_SETOPTIONS to _IOW,
> but this will break compatibility.
> So adding additional condition for performing 'copy_from_user'.

> Signed-off-by: Vitaly Kuzmichev<vkuzmichev@...sta.com>
> ---
>   drivers/watchdog/mpcore_wdt.c |    3 ++-
>   1 files changed, 2 insertions(+), 1 deletions(-)

> diff --git a/drivers/watchdog/mpcore_wdt.c b/drivers/watchdog/mpcore_wdt.c
> index 7a3d6b2..b330a0a 100644
> --- a/drivers/watchdog/mpcore_wdt.c
> +++ b/drivers/watchdog/mpcore_wdt.c
> @@ -240,7 +240,8 @@ static long mpcore_wdt_ioctl(struct file *file, unsigned int cmd,
>   	if (_IOC_DIR(cmd)&&  _IOC_SIZE(cmd)>  sizeof(uarg))
>   		return -ENOTTY;
>
> -	if (_IOC_DIR(cmd) & _IOC_WRITE) {
> +	if (_IOC_DIR(cmd) & _IOC_WRITE

    I think you need parens around this.

> +			|| cmd == WDIOC_SETOPTIONS) {
>   		ret = copy_from_user(&uarg, (void __user *)arg, _IOC_SIZE(cmd));
>   		if (ret)
>   			return -EFAULT;

WBR, Sergei
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ