[PATCH linux 4.4] net/ncsi: start the timer before sending the request

Cédric Le Goater clg at kaod.org
Tue Jul 12 19:52:36 AEST 2016


Currently, the timer is armed after the request is sent. This is racy
with ncsi_rcv_rsp() which discards a response to a NCSI request
received before the timer was enabled.

Signed-off-by: Cédric Le Goater <clg at kaod.org>
---

 The issue is systematic with the fake NCSI backend on qemu

 net/ncsi/ncsi-cmd.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/net/ncsi/ncsi-cmd.c b/net/ncsi/ncsi-cmd.c
index 28f297ac5738..b681220adf09 100644
--- a/net/ncsi/ncsi-cmd.c
+++ b/net/ncsi/ncsi-cmd.c
@@ -351,12 +351,6 @@ int ncsi_xmit_cmd(struct ncsi_cmd_arg *nca)
 		eh->h_source[i] = 0xff;
 	}
 
-	/* Send NCSI packet */
-	skb_get(nr->nr_cmd);
-	ret = dev_queue_xmit(nr->nr_cmd);
-	if (ret)
-		goto out;
-
 	/* Start the timer for the request that might not have
 	 * corresponding response. I'm not sure 1 second delay
 	 * here is enough. Anyway, NCSI is internal network, so
@@ -365,6 +359,12 @@ int ncsi_xmit_cmd(struct ncsi_cmd_arg *nca)
 	nr->nr_timer_enabled = true;
 	mod_timer(&nr->nr_timer, jiffies + 1 * HZ);
 
+	/* Send NCSI packet */
+	skb_get(nr->nr_cmd);
+	ret = dev_queue_xmit(nr->nr_cmd);
+	if (ret)
+		goto out;
+
 	return 0;
 out:
 	ncsi_free_req(nr, false, false);
-- 
2.1.4



More information about the openbmc mailing list