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: <20150528142729.45a8e3abf3f7a8b59bdfc1ce@linux-foundation.org>
Date:	Thu, 28 May 2015 14:27:29 -0700
From:	Andrew Morton <akpm@...ux-foundation.org>
To:	Vignesh R <vigneshr@...com>
Cc:	Rob Herring <robh+dt@...nel.org>, Pawel Moll <pawel.moll@....com>,
	Mark Rutland <mark.rutland@....com>,
	Ian Campbell <ijc+devicetree@...lion.org.uk>,
	Kumar Gala <galak@...eaurora.org>,
	Evgeniy Polyakov <zbr@...emap.net>,
	Jonathan Corbet <corbet@....net>,
	Tony Lindgren <tony@...mide.com>, NeilBrown <neilb@...e.de>,
	Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	Fabian Frederick <fabf@...net.be>,
	<devicetree@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
	<linux-doc@...r.kernel.org>
Subject: Re: [PATCH v2] w1: masters: omap_hdq: Add support for 1-wire mode

On Mon, 18 May 2015 17:39:19 +0530 Vignesh R <vigneshr@...com> wrote:

> This patches makes following changes to omap_hdq driver
>  - Enable 1-wire mode.
>  - Implement w1_triplet callback to facilitate search rom
>    procedure and auto detection of 1-wire slaves.
>  - Proper enabling and disabling of interrupt.
>  - Cleanups (formatting and return value checks).
> 
> HDQ mode remains unchanged.
> 
> ...
>
> +/*
> + * W1 triplet callback function - used for searching ROM addresses.
> + * Registered only when controller is in 1-wire mode.
> + */
> +static u8 omap_w1_triplet(void *_hdq, u8 bdir)
> +{
> +	u8 id_bit, comp_bit;
> +	int err;
> +	u8 ret = 0x3; /* no slaves responded */
> +	struct hdq_data *hdq_data = _hdq;
> +	u8 ctrl = OMAP_HDQ_CTRL_STATUS_SINGLE | OMAP_HDQ_CTRL_STATUS_GO |
> +		  OMAP_HDQ_CTRL_STATUS_INTERRUPTMASK;
> +	u8 mask = ctrl | OMAP_HDQ_CTRL_STATUS_DIR;
> +
> +	omap_hdq_get(_hdq);
> +
> +	err = mutex_lock_interruptible(&hdq_data->hdq_mutex);
> +	if (err < 0) {
> +		dev_dbg(hdq_data->dev, "Could not acquire mutex\n");
> +		goto rtn;
> +	}

The use of mutex_lock_interruptible() seems like a bad idea.  It means
that if the calling process (modprobe?) has a signal pending,
w1_search() will think that "no device responded".  That isn't really
true - a true statement is "user hit ^C".  I'm not sure what the
overall runtime effect of this will be, but I bet it hasn't been
tested!

Wouldn't it be saner/safer to use plain old mutex_lock() here?
--
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