diff --git a/SOURCES/linuxptp-statechange.patch b/SOURCES/linuxptp-statechange.patch
new file mode 100644
index 0000000..26c0ad9
--- /dev/null
+++ b/SOURCES/linuxptp-statechange.patch
@@ -0,0 +1,30 @@
+commit 		17c9787b1d6891636b5be9e4e5a08278b44e9a7a
+Author: 	Miroslav Lichvar <mlichvar@redhat.com>
+Date: 		Fri Sep 01 11:42:26 2017 +0100
+
+		phc2sys: fix handling of multiple state changes.
+
+		When the master clock changed its state and then changed it back to the
+		original state before phc2sys could process the first change, e.g. SLAVE
+		-> UNCALIBRATED -> SLAVE after a clockcheck failure, the second change
+		was ignored because the new value was the same as the original state,
+		which wasn't updated for the first change yet. This caused phc2sys to be
+		stuck with a wrong state.
+
+		Fix phc2sys to check both the state and new_state variables of the clock.
+
+		Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
+
+diff --git a/phc2sys.c b/phc2sys.c
+index b6f6719..e2b5c47 100644
+--- a/phc2sys.c
++++ b/phc2sys.c
+@@ -786,7 +786,7 @@ static int recv_subscribed(struct node *node, struct ptp_message *msg,
+ 			port->state = state;
+ 			clock = port->clock;
+ 			state = clock_compute_state(node, clock);
+-			if (clock->state != state) {
++			if (clock->state != state || clock->new_state) {
+ 				clock->new_state = state;
+ 				node->state_changed = 1;
+ 			}
diff --git a/SPECS/linuxptp.spec b/SPECS/linuxptp.spec
index 7ade9b1..194c6c5 100644
--- a/SPECS/linuxptp.spec
+++ b/SPECS/linuxptp.spec
@@ -3,7 +3,7 @@
 %global clknetsim_ver ce89a1
 Name:		linuxptp
 Version:	1.8
-Release:	3%{?dist}
+Release:	3%{?dist}.1
 Summary:	PTP implementation for Linux
 
 Group:		System Environment/Base
@@ -30,6 +30,8 @@ Patch3:		linuxptp-swtscheck.patch
 Patch4:		linuxptp-closesocket.patch
 # force BMC election when link goes down
 Patch5:		linuxptp-linkdown.patch
+# Fix phc2sys to check both the state and new_state variables of the clock
+Patch6:   linuxptp-statechange.patch
 
 BuildRequires:	systemd-units
 
@@ -51,6 +53,7 @@ Supporting legacy APIs and other platforms is not a goal.
 %patch3 -p1 -b .swtscheck
 %patch4 -p1 -b .closesocket
 %patch5 -p1 -b .linkdown
+%patch6 -p1 -b .statechange
 mv linuxptp-testsuite-%{testsuite_ver}* testsuite
 mv clknetsim-%{clknetsim_ver}* testsuite/clknetsim
 
@@ -109,6 +112,9 @@ PATH=..:$PATH ./run
 %{_mandir}/man8/*.8*
 
 %changelog
+* Fri Sep 08 2017 Michal Ruprich <mruprich@redhat.com> 1.8-3.1
+- Resolves: #1489425 - Race condition in phc2sys
+
 * Wed Mar 15 2017 Miroslav Lichvar <mlichvar@redhat.com> 1.8-3
 - fix backport of linkdown patch