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: <20110711213259.GE5811@pengutronix.de>
Date:	Mon, 11 Jul 2011 23:32:59 +0200
From:	Wolfram Sang <w.sang@...gutronix.de>
To:	Wim Van Sebroeck <wim@...ana.be>
Cc:	LKML <linux-kernel@...r.kernel.org>,
	Linux Watchdog Mailing List <linux-watchdog@...r.kernel.org>,
	Alan Cox <alan@...rguk.ukuu.org.uk>
Subject: Re: [PATCH 04/11] watchdog: WatchDog Timer Driver Core - Add
 WDIOC_SETOPTIONS ioctl


> @@ -121,6 +171,7 @@ static long watchdog_ioctl(struct file *file, unsigned int cmd,
>  	void __user *argp = (void __user *)arg;
>  	int __user *p = argp;
>  	unsigned int val;
> +	int err;
>  
>  	switch (cmd) {
>  	case WDIOC_GETSUPPORT:
> @@ -131,6 +182,20 @@ static long watchdog_ioctl(struct file *file, unsigned int cmd,
>  		return put_user(val, p);
>  	case WDIOC_GETBOOTSTATUS:
>  		return put_user(wdd->bootstatus, p);
> +	case WDIOC_SETOPTIONS:
> +		if (get_user(val, p))
> +			return -EFAULT;
> +		if (val & WDIOS_DISABLECARD) {
> +			err = watchdog_stop(wdd);
> +			if (err < 0)
> +				return err;
> +		}
> +		if (val & WDIOS_ENABLECARD) {
> +			err = watchdog_start(wdd);
> +			if (err < 0)
> +				return err;
> +		}
> +		return 0;
>  	case WDIOC_KEEPALIVE:
>  		if (!(wdd->info->options & WDIOF_KEEPALIVEPING))
>  			return -EOPNOTSUPP;
> @@ -168,7 +233,7 @@ static int watchdog_open(struct inode *inode, struct file *file)
>  		goto out;
>  
>  	/* start the watchdog */
> -	err = wdd->ops->start(wdd);
> +	err = watchdog_start(wdd);

I think we still might need open- and close-callbacks here. Some drivers turn
on/off clocks on these operations and we can't simply move them to the
start/stop callbacks, because the clock might be turned off via DISABLECARD
which calls stop. And without the clock, a simple register access via
set_timeout might lock up the machine.

>  	if (err < 0)
>  		goto out_mod;
>  
> @@ -195,8 +260,8 @@ static int watchdog_release(struct inode *inode, struct file *file)
>  	int err;
>  
>  	/* stop the watchdog */
> -	err = wdd->ops->stop(wdd);
> -	if (err != 0) {
> +	err = watchdog_stop(wdd);
> +	if (err < 0) {
>  		pr_crit("%s: watchdog did not stop!\n", wdd->info->identity);
>  		watchdog_ping(wdd);
>  	}
> diff --git a/include/linux/watchdog.h b/include/linux/watchdog.h
> index a2b639b..853387f 100644
> --- a/include/linux/watchdog.h
> +++ b/include/linux/watchdog.h
> @@ -81,6 +81,7 @@ struct watchdog_device {
>  	void *priv;
>  	unsigned long status;
>  /* Bit numbers for status flags */
> +#define WDOG_ACTIVE		0	/* Is the watchdog running/active */
>  #define WDOG_DEV_OPEN		1	/* Opened via /dev/watchdog ? */
>  };
>  
> -- 
> 1.7.6
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-watchdog" in
> the body of a message to majordomo@...r.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

-- 
Pengutronix e.K.                           | Wolfram Sang                |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |

Download attachment "signature.asc" of type "application/pgp-signature" (199 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ