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: <20110426115222.1a994107@lxorguk.ukuu.org.uk>
Date:	Tue, 26 Apr 2011 11:52:22 +0100
From:	Alan Cox <alan@...rguk.ukuu.org.uk>
To:	Jimmy Chen (陳永達) <jimmy.chen@...a.com>
Cc:	<linux-kernel@...r.kernel.org>, <linux-watchdog@...r.kernel.org>,
	<wim@...ana.be>
Subject: Re: [PATCH 2/2] watchdog: add real function on MOXA V2100 watchdog
 driver

> +	superio_set_logic_device(7);    /* logic device 7 */
> +	superio_set_reg((swtd_ack_time/1000), 0x73);    /* Reg:F6,30 sec */
> +}

If the time is configurable then you want to support that ideally.

> +static void swtd_reboot(void *unused)

No - the watchdog driver needs to deal with hardware reboot, randomly
trying to exec things which may not even be where you expect isn't safe.
User space watchdog daemons can manage their own shutdown just fine. The
watchdog is there to catch the actual hang case.


> +	superio_set_reg(1000/1000, 0x73);
> +
> +	return NOTIFY_OK;
> +
> +	spin_unlock_bh(&swtd_lock);

Wrong order - your lock is left locked !


> +static struct miscdevice wdt_miscdev = {
> +	.minor = MOXA_WATCHDOG_MINOR,
> +	.name = "swtd",
> +	.fops = &moxa_swtd_fops,
> +};

This should use the standard watchdog device


> +moxa_swtd_init_err3:
> +	remove_proc_entry("driver/swtd", NULL);
> +moxa_swtd_init_err2:
> +	if (timer_pending(&timer_swtd))
> +		del_timer(&timer_swtd);

del_timer_sync to ensure it has run

You also need to sort out locking.

There is also no test to ensure the hardware is present so the driver
isn't safe to load on any PC hardware

Is there a magic signature to detect the hardware ?

Alan
--
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