Skip to content

w1_therm: Back-port locking improvements from 4.2-rc1 #1059

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jul 13, 2015

Conversation

pelwell
Copy link
Contributor

@pelwell pelwell commented Jul 13, 2015

It is possible to crash the w1_therm module by removing a node
(echo $slave >/sys/devices/w1_bus_master/w1_master_remove) while a read
is in progress. The 4.2-rc1 release contains a patch adding reference
counting to avoid this problem. Back-port that patch along with other
upstream improvements.

See: #872

dfries and others added 4 commits July 10, 2015 15:23
A temperature conversion can take 750 ms and when possible the
w1_therm slave driver drops the bus_mutex to allow other bus
operations, but that includes operations such as a periodic slave
search, which can remove this slave when it is no longer detected.
If that happens the sl->family_data will be freed and set to NULL
causing w1_slave_show to crash when it wakes up.

Signed-off-by: David Fries <[email protected]>
Reported-By: Thorsten Bschorr <[email protected]>
Tested-by: Thorsten Bschorr <[email protected]>
Acked-by: Evgeniy Polyakov <[email protected]>
Cc: stable <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
This patch provides support for the DS28EA00 digital thermometer.

The DS28EA00 provides an additional two pins for implementing a sequence
detection algorithm.  This feature allows you to determine the physical
location of the chip in the 1-wire bus without needing pre-existing
knowledge of the bus ordering.  Support is provided through the sysfs
w1_seq file.  The file will contain a single line with an integer value
representing the device index in the bus starting at 0.

Signed-off-by: Matt Campbell <[email protected]>
Acked-by: Evgeniy Polyakov <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
The W1_42_FINISHED_BYTE is 0xFF so the cast means the condition is
never true.

Fixes: d9411e5 ('w1: Add support for DS28EA00 sequence to w1-therm')
Signed-off-by: Dan Carpenter <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
I noticed there was a problem here because Smatch complained:

	drivers/w1/slaves/w1_therm.c:416 w1_seq_show() warn:
	inconsistent returns 'mutex:&sl->master->mutex'.
	  Locked on:   line 416
	  Unlocked on: line 413

The problem is that we lock ->mutex but we unlock ->bus_mutex on error.
David Fries says that ->bus_mutex is correct and ->mutex is incorrect.

Fixes: d9411e5 ('w1: Add support for DS28EA00 sequence to w1-therm')
Signed-off-by: Dan Carpenter <[email protected]>
Acked-by: Evgeniy Polyakov <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
@popcornmix
Copy link
Collaborator

No objections from me.

pelwell added a commit that referenced this pull request Jul 13, 2015
w1_therm: Back-port locking improvements from 4.2-rc1
@pelwell pelwell merged commit a3e76d8 into raspberrypi:rpi-4.0.y Jul 13, 2015
pelwell added a commit that referenced this pull request Jul 13, 2015
w1_therm: Back-port locking improvements from 4.2-rc1
popcornmix added a commit to raspberrypi/firmware that referenced this pull request Jul 13, 2015
kernel: w1_therm: Back-port locking improvements from 4.2-rc1
See: raspberrypi/linux#1059

kernel: Added support for 2 mcp2515 CAN Bus IC
See: raspberrypi/linux#1018

kernel: BCM270X_DT: Overlay for the Fen Logic VGA666 board
(really added this time)

firmware: di_adv: Add qpu shader code to implement deinterlace
firmware: image_fx: Support YUV_UV as destination format if requested
firmware: dmalib: Reduce default priority and burst size of 2d memcpy

arm_loader: Ensure reserved qpus are freed and ISR blocks until interrupt cleared

gpioman: If dt-blob.bin file is incompatible, use built-in
See: https://www.raspberrypi.org/forums/viewtopic.php?f=29&t=113753&start=75#p788079
popcornmix added a commit to Hexxeh/rpi-firmware that referenced this pull request Jul 13, 2015
kernel: w1_therm: Back-port locking improvements from 4.2-rc1
See: raspberrypi/linux#1059

kernel: Added support for 2 mcp2515 CAN Bus IC
See: raspberrypi/linux#1018

kernel: BCM270X_DT: Overlay for the Fen Logic VGA666 board
(really added this time)

firmware: di_adv: Add qpu shader code to implement deinterlace
firmware: image_fx: Support YUV_UV as destination format if requested
firmware: dmalib: Reduce default priority and burst size of 2d memcpy

arm_loader: Ensure reserved qpus are freed and ISR blocks until interrupt cleared

gpioman: If dt-blob.bin file is incompatible, use built-in
See: https://www.raspberrypi.org/forums/viewtopic.php?f=29&t=113753&start=75#p788079
pelwell added a commit that referenced this pull request Jul 24, 2015
w1_therm: Back-port locking improvements from 4.2-rc1
pelwell added a commit that referenced this pull request Aug 5, 2015
w1_therm: Back-port locking improvements from 4.2-rc1
pelwell added a commit that referenced this pull request Aug 17, 2015
w1_therm: Back-port locking improvements from 4.2-rc1
pelwell added a commit that referenced this pull request Sep 14, 2015
w1_therm: Back-port locking improvements from 4.2-rc1
pelwell added a commit that referenced this pull request Sep 14, 2015
w1_therm: Back-port locking improvements from 4.2-rc1
pelwell added a commit that referenced this pull request Sep 22, 2015
w1_therm: Back-port locking improvements from 4.2-rc1
pelwell added a commit that referenced this pull request Oct 3, 2015
w1_therm: Back-port locking improvements from 4.2-rc1
pelwell added a commit that referenced this pull request Oct 6, 2015
w1_therm: Back-port locking improvements from 4.2-rc1
pelwell added a commit that referenced this pull request Oct 7, 2015
w1_therm: Back-port locking improvements from 4.2-rc1
pelwell added a commit that referenced this pull request Oct 8, 2015
w1_therm: Back-port locking improvements from 4.2-rc1
pelwell added a commit that referenced this pull request Oct 8, 2015
w1_therm: Back-port locking improvements from 4.2-rc1
pelwell added a commit that referenced this pull request Oct 9, 2015
w1_therm: Back-port locking improvements from 4.2-rc1
pelwell added a commit that referenced this pull request Oct 25, 2015
w1_therm: Back-port locking improvements from 4.2-rc1
pelwell added a commit that referenced this pull request Oct 28, 2015
w1_therm: Back-port locking improvements from 4.2-rc1
popcornmix pushed a commit that referenced this pull request Feb 20, 2016
w1_therm: Back-port locking improvements from 4.2-rc1
neuschaefer pushed a commit to neuschaefer/raspi-binary-firmware that referenced this pull request Feb 27, 2017
kernel: w1_therm: Back-port locking improvements from 4.2-rc1
See: raspberrypi/linux#1059

kernel: Added support for 2 mcp2515 CAN Bus IC
See: raspberrypi/linux#1018

kernel: BCM270X_DT: Overlay for the Fen Logic VGA666 board
(really added this time)

firmware: di_adv: Add qpu shader code to implement deinterlace
firmware: image_fx: Support YUV_UV as destination format if requested
firmware: dmalib: Reduce default priority and burst size of 2d memcpy

arm_loader: Ensure reserved qpus are freed and ISR blocks until interrupt cleared

gpioman: If dt-blob.bin file is incompatible, use built-in
See: https://www.raspberrypi.org/forums/viewtopic.php?f=29&t=113753&start=75#p788079
@josephtech1
Copy link

Hi,
I am currently attempting to connect 6 DS28EA00's to a RPi3 using w1 therm kernel. Currently, I am getting "cat: w1_seq: Input/output error" when I try to retrieve the indexes of my sensors. Each device is listed in "/sys/bus/w1/devices" as is expected, and the "w1_slave" lists contents as expected. I did notice on the seq detect patch that the seq detect protocol used is a bit different than specified in the datasheet of the sensor. Is anyone having success detecting sequence with this detector?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants