<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel.git/drivers/iio/imu, branch linux-4.1.y</title>
<subtitle>Hosts the 0x221E linux distro kernel.
</subtitle>
<id>https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-4.1.y</id>
<link rel='self' href='https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-4.1.y'/>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/'/>
<updated>2018-03-04T15:28:34Z</updated>
<entry>
<title>iio: adis_lib: Initialize trigger before requesting interrupt</title>
<updated>2018-03-04T15:28:34Z</updated>
<author>
<name>Lars-Peter Clausen</name>
</author>
<published>2018-02-14T14:43:00Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=e71aa849fd7a83b1c1e29f79ecee64255d5184ec'/>
<id>urn:sha1:e71aa849fd7a83b1c1e29f79ecee64255d5184ec</id>
<content type='text'>
[ Upstream commit f027e0b3a774e10302207e91d304bbf99e3a8b36 ]

The adis_probe_trigger() creates a new IIO trigger and requests an
interrupt associated with the trigger. The interrupt uses the generic
iio_trigger_generic_data_rdy_poll() function as its interrupt handler.

Currently the driver initializes some fields of the trigger structure after
the interrupt has been requested. But an interrupt can fire as soon as it
has been requested. This opens up a race condition.

iio_trigger_generic_data_rdy_poll() will access the trigger data structure
and dereference the ops field. If the ops field is not yet initialized this
will result in a NULL pointer deref.

It is not expected that the device generates an interrupt at this point, so
typically this issue did not surface unless e.g. due to a hardware
misconfiguration (wrong interrupt number, wrong polarity, etc.).

But some newer devices from the ADIS family start to generate periodic
interrupts in their power-on reset configuration and unfortunately the
interrupt can not be masked in the device.  This makes the race condition
much more visible and the following crash has been observed occasionally
when booting a system using the ADIS16460.

	Unable to handle kernel NULL pointer dereference at virtual address 00000008
	pgd = c0004000
	[00000008] *pgd=00000000
	Internal error: Oops: 5 [#1] PREEMPT SMP ARM
	Modules linked in:
	CPU: 0 PID: 1 Comm: swapper/0 Not tainted 4.9.0-04126-gf9739f0-dirty #257
	Hardware name: Xilinx Zynq Platform
	task: ef04f640 task.stack: ef050000
	PC is at iio_trigger_notify_done+0x30/0x68
	LR is at iio_trigger_generic_data_rdy_poll+0x18/0x20
	pc : [&lt;c042d868&gt;]    lr : [&lt;c042d924&gt;]    psr: 60000193
	sp : ef051bb8  ip : 00000000  fp : ef106400
	r10: c081d80a  r9 : ef3bfa00  r8 : 00000087
	r7 : ef051bec  r6 : 00000000  r5 : ef3bfa00  r4 : ee92ab00
	r3 : 00000000  r2 : 00000000  r1 : 00000000  r0 : ee97e400
	Flags: nZCv  IRQs off  FIQs on  Mode SVC_32  ISA ARM  Segment none
	Control: 18c5387d  Table: 0000404a  DAC: 00000051
	Process swapper/0 (pid: 1, stack limit = 0xef050210)
	[&lt;c042d868&gt;] (iio_trigger_notify_done) from [&lt;c0065b10&gt;] (__handle_irq_event_percpu+0x88/0x118)
	[&lt;c0065b10&gt;] (__handle_irq_event_percpu) from [&lt;c0065bbc&gt;] (handle_irq_event_percpu+0x1c/0x58)
	[&lt;c0065bbc&gt;] (handle_irq_event_percpu) from [&lt;c0065c30&gt;] (handle_irq_event+0x38/0x5c)
	[&lt;c0065c30&gt;] (handle_irq_event) from [&lt;c0068e28&gt;] (handle_level_irq+0xa4/0x130)
	[&lt;c0068e28&gt;] (handle_level_irq) from [&lt;c0064e74&gt;] (generic_handle_irq+0x24/0x34)
	[&lt;c0064e74&gt;] (generic_handle_irq) from [&lt;c021ab7c&gt;] (zynq_gpio_irqhandler+0xb8/0x13c)
	[&lt;c021ab7c&gt;] (zynq_gpio_irqhandler) from [&lt;c0064e74&gt;] (generic_handle_irq+0x24/0x34)
	[&lt;c0064e74&gt;] (generic_handle_irq) from [&lt;c0065370&gt;] (__handle_domain_irq+0x5c/0xb4)
	[&lt;c0065370&gt;] (__handle_domain_irq) from [&lt;c000940c&gt;] (gic_handle_irq+0x48/0x8c)
	[&lt;c000940c&gt;] (gic_handle_irq) from [&lt;c0013e8c&gt;] (__irq_svc+0x6c/0xa8)

To fix this make sure that the trigger is fully initialized before
requesting the interrupt.

Fixes: ccd2b52f4ac6 ("staging:iio: Add common ADIS library")
Reported-by: Robin Getz &lt;Robin.Getz@analog.com&gt;
Signed-off-by: Lars-Peter Clausen &lt;lars@metafoo.de&gt;
Cc: &lt;Stable@vger.kernel.org&gt;
Signed-off-by: Jonathan Cameron &lt;Jonathan.Cameron@huawei.com&gt;
Signed-off-by: Sasha Levin &lt;alexander.levin@microsoft.com&gt;
</content>
</entry>
<entry>
<title>iio: imu: adis16480: Fix acceleration scale factor for adis16480</title>
<updated>2017-10-04T01:36:36Z</updated>
<author>
<name>Dragos Bogdan</name>
</author>
<published>2017-08-03T22:37:27Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=cf756f189f01bc88fcfc34603e79c40139a16662'/>
<id>urn:sha1:cf756f189f01bc88fcfc34603e79c40139a16662</id>
<content type='text'>
[ Upstream commit fdd0d32eb95f135041236a6885d9006315aa9a1d ]

According to the datasheet, the range of the acceleration is [-10 g, + 10 g],
so the scale factor should be 10 instead of 5.

Signed-off-by: Dragos Bogdan &lt;dragos.bogdan@analog.com&gt;
Acked-by: Lars-Peter Clausen &lt;lars@metafoo.de&gt;
Cc: &lt;Stable@vger.kernel.org&gt;
Signed-off-by: Jonathan Cameron &lt;Jonathan.Cameron@huawei.com&gt;
Signed-off-by: Sasha Levin &lt;alexander.levin@verizon.com&gt;
</content>
</entry>
<entry>
<title>iio: adis_buffer: Fix out-of-bounds memory access</title>
<updated>2016-04-12T02:07:36Z</updated>
<author>
<name>Lars-Peter Clausen</name>
</author>
<published>2015-11-27T13:55:56Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=3e77cb858ce67861e142186e3b131c04ddbc6edd'/>
<id>urn:sha1:3e77cb858ce67861e142186e3b131c04ddbc6edd</id>
<content type='text'>
[ Upstream commit d590faf9e8f8509a0a0aa79c38e87fcc6b913248 ]

The SPI tx and rx buffers are both supposed to be scan_bytes amount of
bytes large and a common allocation is used to allocate both buffers. This
puts the beginning of the tx buffer scan_bytes bytes after the rx buffer.
The initialization of the tx buffer pointer is done adding scan_bytes to
the beginning of the rx buffer, but since the rx buffer is of type __be16
this will actually add two times as much and the tx buffer ends up pointing
after the allocated buffer.

Fix this by using scan_count, which is scan_bytes / 2, instead of
scan_bytes when initializing the tx buffer pointer.

Fixes: aacff892cbd5 ("staging:iio:adis: Preallocate transfer message")
Signed-off-by: Lars-Peter Clausen &lt;lars@metafoo.de&gt;
Cc: &lt;Stable@vger.kernel.org&gt;
Signed-off-by: Jonathan Cameron &lt;jic23@kernel.org&gt;
Signed-off-by: Sasha Levin &lt;sasha.levin@oracle.com&gt;
</content>
</entry>
<entry>
<title>iio: adis16480: Fix scale factors</title>
<updated>2015-09-21T17:05:28Z</updated>
<author>
<name>Lars-Peter Clausen</name>
</author>
<published>2015-08-05T13:38:15Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=da4ecf32643639585af69bf5f0e5143198e43c39'/>
<id>urn:sha1:da4ecf32643639585af69bf5f0e5143198e43c39</id>
<content type='text'>
commit 7abad1063deb0f77d275c61f58863ec319c58c5c upstream.

The different devices support by the adis16480 driver have slightly
different scales for the gyroscope and accelerometer channels.

Signed-off-by: Lars-Peter Clausen &lt;lars@metafoo.de&gt;
Signed-off-by: Jonathan Cameron &lt;jic23@kernel.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>iio: adis16400: Fix adis16448 gyroscope scale</title>
<updated>2015-09-21T17:05:28Z</updated>
<author>
<name>Lars-Peter Clausen</name>
</author>
<published>2015-08-05T13:38:13Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=dfc28f84d3d1d45bf2720362ee03420b8637d4ba'/>
<id>urn:sha1:dfc28f84d3d1d45bf2720362ee03420b8637d4ba</id>
<content type='text'>
commit 8166537283b31d7abaae9e56bd48fbbc30cdc579 upstream.

Use the correct scale for the adis16448 gyroscope output.

Signed-off-by: Lars-Peter Clausen &lt;lars@metafoo.de&gt;
Signed-off-by: Jonathan Cameron &lt;jic23@kernel.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>iio: inv-mpu: Specify the expected format/precision for write channels</title>
<updated>2015-08-03T16:29:01Z</updated>
<author>
<name>Adriana Reus</name>
</author>
<published>2015-06-12T15:10:23Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=85250adce4a27debef10bd510ddfc4de928b4586'/>
<id>urn:sha1:85250adce4a27debef10bd510ddfc4de928b4586</id>
<content type='text'>
commit 6a3c45bb5a385be7049a7725a4fe93eaa76915f4 upstream.

The gyroscope needs IIO_VAL_INT_PLUS_NANO for the scale channel and
unless specified write returns MICRO by default.
This needs to be properly specified so that write operations into scale
have the expected behaviour.

Signed-off-by: Adriana Reus &lt;adriana.reus@intel.com&gt;
Signed-off-by: Jonathan Cameron &lt;jic23@kernel.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>iio: adis16400: Fix burst transfer for adis16448</title>
<updated>2015-05-16T10:01:20Z</updated>
<author>
<name>Lars-Peter Clausen</name>
</author>
<published>2015-05-15T15:18:38Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=d046ba268adb87c7780494ecf897cbafbf100d57'/>
<id>urn:sha1:d046ba268adb87c7780494ecf897cbafbf100d57</id>
<content type='text'>
The adis16448, unlike the other chips in this family, in addition to the
hardware channels also sends out the DIAG_STAT register in burst mode
before them. Handle that case by skipping over the first 2 bytes before we
pass the received data to the buffer.

Signed-off-by: Lars-Peter Clausen &lt;lars@metafoo.de&gt;
Fixes: 76ada52f7f5d ("iio:adis16400: Add support for the adis16448")
Cc: &lt;stable@vger.kernel.org&gt;
Signed-off-by: Jonathan Cameron &lt;jic23@kernel.org&gt;
</content>
</entry>
<entry>
<title>iio: adis16400: Fix burst mode</title>
<updated>2015-05-16T10:00:50Z</updated>
<author>
<name>Paul Cercueil</name>
</author>
<published>2015-05-15T15:18:37Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=9df560350c90f3d3909fe653399b3584c9a17b61'/>
<id>urn:sha1:9df560350c90f3d3909fe653399b3584c9a17b61</id>
<content type='text'>
There are a few issues with the burst mode support. For one we don't setup
the rx buffer, so the buffer will never be filled and all samples will read
as the zero. Furthermore the tx buffer has the wrong type, which means the
driver sends the wrong command and not the right data is returned.

The final issue is that in burst mode all channels are transferred. Hence
the length of the transfer length should be the number of hardware
channels * 2 bytes. Currently the driver uses indio_dev-&gt;scan_bytes for
this. But if the timestamp channel is enabled the scan_bytes will be larger
than the burst length. Fix this by just calculating the burst length based
on the number of hardware channels.

Signed-off-by: Paul Cercueil &lt;paul.cercueil@analog.com&gt;
Signed-off-by: Lars-Peter Clausen &lt;lars@metafoo.de&gt;
Fixes: 5eda3550a3cc ("staging:iio:adis16400: Preallocate transfer message")
Cc: &lt;stable@vger.kernel.org&gt;
Signed-off-by: Jonathan Cameron &lt;jic23@kernel.org&gt;
</content>
</entry>
<entry>
<title>iio: adis16400: Compute the scan mask from channel indices</title>
<updated>2015-05-16T09:58:36Z</updated>
<author>
<name>Paul Cercueil</name>
</author>
<published>2015-05-15T15:18:36Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=c2a8b623a089d52c199e305e7905829907db8ec8'/>
<id>urn:sha1:c2a8b623a089d52c199e305e7905829907db8ec8</id>
<content type='text'>
We unfortunately can't use ~0UL for the scan mask to indicate that the
only valid scan mask is all channels selected. The IIO core needs the exact
mask to work correctly and not a super-set of it. So calculate the masked
based on the channels that are available for a particular device.

Signed-off-by: Paul Cercueil &lt;paul.cercueil@analog.com&gt;
Signed-off-by: Lars-Peter Clausen &lt;lars@metafoo.de&gt;
Fixes: 5eda3550a3cc ("staging:iio:adis16400: Preallocate transfer message")
Cc: &lt;stable@vger.kernel.org&gt;
Signed-off-by: Jonathan Cameron &lt;jic23@kernel.org&gt;
</content>
</entry>
<entry>
<title>iio: adis16400: Use != channel indices for the two voltage channels</title>
<updated>2015-05-16T09:57:07Z</updated>
<author>
<name>Paul Cercueil</name>
</author>
<published>2015-05-15T15:18:35Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=7323d59862802ca109451eeda9777024a7625509'/>
<id>urn:sha1:7323d59862802ca109451eeda9777024a7625509</id>
<content type='text'>
Previously, the two voltage channels had the same ID, which didn't cause
conflicts in sysfs only because one channel is named and the other isn't;
this is still violating the spec though, two indexed channels should never
have the same index.

Signed-off-by: Paul Cercueil &lt;paul.cercueil@analog.com&gt;
Signed-off-by: Lars-Peter Clausen &lt;lars@metafoo.de&gt;
Cc: &lt;stable@vger.kernel.org&gt;
Signed-off-by: Jonathan Cameron &lt;jic23@kernel.org&gt;
</content>
</entry>
</feed>
