From da83a4a9a44a338f7f0c02451fc372c150e560c7 Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Thu, 9 Jun 2016 21:39:45 +0000 Subject: [PATCH] ib_srpt: Serialize sport->port_id accesses git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@6900 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- srpt/src/ib_srpt.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/srpt/src/ib_srpt.c b/srpt/src/ib_srpt.c index f265d9af9..410c392eb 100644 --- a/srpt/src/ib_srpt.c +++ b/srpt/src/ib_srpt.c @@ -484,7 +484,9 @@ static void srpt_get_ioc(struct srpt_port *sport, u32 slot, send_queue_depth = min(SRPT_RQ_SIZE, sdev->dev_attr.max_qp_wr); memset(iocp, 0, sizeof(*iocp)); - strcpy(iocp->id_string, sport->port_id); + mutex_lock(&sport->mutex); + strlcpy(iocp->id_string, sport->port_id, sizeof(iocp->id_string)); + mutex_unlock(&sport->mutex); iocp->guid = cpu_to_be64(srpt_service_guid); iocp->vendor_id = cpu_to_be32(sdev->dev_attr.vendor_id); iocp->device_id = cpu_to_be32(sdev->dev_attr.vendor_part_id);