From patchwork Thu Mar 8 00:54:14 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 10265717 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 3D76A6016D for ; Thu, 8 Mar 2018 00:54:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1EC64295B4 for ; Thu, 8 Mar 2018 00:54:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 099DF295C2; Thu, 8 Mar 2018 00:54:18 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8657F295B4 for ; Thu, 8 Mar 2018 00:54:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934149AbeCHAyQ (ORCPT ); Wed, 7 Mar 2018 19:54:16 -0500 Received: from esa1.hgst.iphmx.com ([68.232.141.245]:36665 "EHLO esa1.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933575AbeCHAyQ (ORCPT ); Wed, 7 Mar 2018 19:54:16 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1520470455; x=1552006455; h=from:to:cc:subject:date:message-id; bh=9x2w1AkePtbc0yP+S9ZmoEcu/l3WxEW2OWTby0hwMK4=; b=Yv7uYDYk09sPvNm/39lk9OuGGdILFYiJG2kjQYbPVtLPlpXnHSYKXqFh YEeroH6zqxEkNCN7IKJZibmriIZZqKuxQadCXkfNQJOGgcE930NeTOsbt 1JaHd8QwyY6Tq7LRzxz9L4H56w/crfxHe2TQSGZD7sB6pEm2St1nxa4SX MgYZFrzpedu4/XO5vqBzdFKF7hpcUIJiwi1V04UgnYXmzyDSZFvnPSFqi om1WELz59hdZy+Djg6GeuKAlGkceGKmul/WvviWEjurrIrkBXesSwln+P Mj2rSPK3zxy9UIPRxV7G502w0ZbbyAfyH1CcFzXWG5hweBnQBv9UFCJtZ A==; X-IronPort-AV: E=Sophos;i="5.47,438,1515427200"; d="scan'208";a="176167495" Received: from uls-op-cesaip02.wdc.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 08 Mar 2018 08:54:15 +0800 Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep02.wdc.com with ESMTP; 07 Mar 2018 16:47:28 -0800 Received: from thinkpad-bart.sdcorp.global.sandisk.com (HELO thinkpad-bart.int.fusionio.com) ([10.11.171.236]) by uls-op-cesaip01.wdc.com with ESMTP; 07 Mar 2018 16:54:15 -0800 From: Bart Van Assche To: Jason Gunthorpe Cc: Doug Ledford , linux-rdma@vger.kernel.org, Bart Van Assche Subject: [PATCH] IB/srp: Fix IPv6 address parsing Date: Wed, 7 Mar 2018 16:54:14 -0800 Message-Id: <20180308005414.28692-1-bart.vanassche@wdc.com> X-Mailer: git-send-email 2.16.2 Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- 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;