Split IPv6 addresses at the colon that separates the IPv6 address and the port number instead of at a colon in the middle of the IPv6 address. Fixes: 19f313438c77 ("IB/srp: Add RDMA/CM support") Signed-off-by: Bart Van Assche <bart.vanassche@xxxxxxx> --- drivers/infiniband/ulp/srp/ib_srp.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/infiniband/ulp/srp/ib_srp.c b/drivers/infiniband/ulp/srp/ib_srp.c index 9a5ea6251450..1fe24b82d851 100644 --- a/drivers/infiniband/ulp/srp/ib_srp.c +++ b/drivers/infiniband/ulp/srp/ib_srp.c @@ -3418,12 +3418,15 @@ static int srp_parse_in(struct net *net, struct sockaddr_storage *sa, const char *addr_port_str) { char *addr = kstrdup(addr_port_str, GFP_KERNEL); - char *port_str = addr; + char *port_str; int ret; if (!addr) return -ENOMEM; - strsep(&port_str, ":"); + port_str = strrchr(addr, ':'); + if (!port_str) + return -EINVAL; + *port_str++ = '\0'; ret = inet_pton_with_scope(net, AF_UNSPEC, addr, port_str, sa); kfree(addr); return ret; -- 2.16.2 -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html