net/smc: fix smc_poll in SMC_INIT state [Linux 5.0]

This Linux kernel change "net/smc: fix smc_poll in SMC_INIT state" is included in the Linux 5.0 release. This change is authored by Ursula Braun <ubraun [at] linux.ibm.com> on Thu Feb 21 12:56:54 2019 +0100. The commit for this change in Linux stable tree is d7cf4a3 (patch).

net/smc: fix smc_poll in SMC_INIT state

smc_poll() returns with mask bit EPOLLPRI if the connection urg_state
is SMC_URG_VALID. Since SMC_URG_VALID is zero, smc_poll signals
EPOLLPRI errorneously if called in state SMC_INIT before the connection
is created, for instance in a non-blocking connect scenario.

This patch switches to non-zero values for the urg states.

Reviewed-by: Karsten Graul <[email protected]>
Fixes: de8474eb9d50 ("net/smc: urgent data support")
Signed-off-by: Ursula Braun <[email protected]>
Signed-off-by: David S. Miller <[email protected]>

There are 6 lines of Linux source code added/deleted in this change. Code changes to Linux kernel are as follows.

 net/smc/smc.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/net/smc/smc.h b/net/smc/smc.h
index 5721416..adbdf19 100644
--- a/net/smc/smc.h
+++ b/net/smc/smc.h
@@ -113,9 +113,9 @@ struct smc_host_cdc_msg {       /* Connection Data Control message */
 } __aligned(8);

 enum smc_urg_state {
-   SMC_URG_VALID,          /* data present */
-   SMC_URG_NOTYET,         /* data pending */
-   SMC_URG_READ            /* data was already read */
+   SMC_URG_VALID   = 1,            /* data present */
+   SMC_URG_NOTYET  = 2,            /* data pending */
+   SMC_URG_READ    = 3,            /* data was already read */
 };

 struct smc_connection {

Leave a Reply

Your email address will not be published. Required fields are marked *