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] [day] [month] [year] [list]
Message-Id: <20070725222019.a8e3cc00.akpm@linux-foundation.org>
Date:	Wed, 25 Jul 2007 22:20:19 -0700
From:	Andrew Morton <akpm@...ux-foundation.org>
To:	dougthompson@...ssion.com
Cc:	greg@...ah.com, ralf@...ux-mips.org, egor@...emi.com,
	alan@...rguk.ukuu.org.uk, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/4] drivers edac fix reset edac_mc pollmsec

On Wed, 25 Jul 2007 14:54:21 -0600 dougthompson@...ssion.com wrote:

> +void edac_mc_reset_delay_period(int value)
>  {
> -	/* cancel the current workq request */
> -	edac_mc_workq_teardown(mci);
> +	struct mem_ctl_info *mci;
> +	struct list_head *item;
> +
> +	mutex_lock(&mem_ctls_mutex);
> +
> +	/* scan the list and turn off all workq timers, doing so under lock
> +	 */
> +	list_for_each(item, &mc_devices) {
> +		mci = list_entry(item, struct mem_ctl_info, link);
> +
> +		if (mci->op_state == OP_RUNNING_POLL)
> +			cancel_delayed_work(&mci->work);
> +	}
> +
> +	mutex_unlock(&mem_ctls_mutex);

cancel_delayed_work() on its own looks a bit racy.  The work could
presently be running on another CPU.

So generally we'll run flush_workqueue() or cancel_work_sync() after the
cancel_delayed_work() to make sure that it has really gone away.

Beware however that you're holding a lock here.  If any of the work
functions which can be at mci->work also take mem_ctls_mutex then it is
deadlocky to run flush_workqueue() or cancel_work_sync() while holding that
lock.

-
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