From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM02-CY1-obe.outbound.protection.outlook.com (mail-cys01nam02on0042.outbound.protection.outlook.com [104.47.37.42]) by dpdk.org (Postfix) with ESMTP id 4A040FE5 for ; Fri, 31 Mar 2017 07:29:50 +0200 (CEST) Received: from DM5PR03CA0007.namprd03.prod.outlook.com (10.175.104.17) by BY2PR03MB395.namprd03.prod.outlook.com (10.141.141.14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1005.10; Fri, 31 Mar 2017 05:29:48 +0000 Received: from BL2FFO11FD010.protection.gbl (2a01:111:f400:7c09::147) by DM5PR03CA0007.outlook.office365.com (2603:10b6:3:118::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1005.10 via Frontend Transport; Fri, 31 Mar 2017 05:29:48 +0000 Authentication-Results: spf=fail (sender IP is 192.88.168.50) smtp.mailfrom=nxp.com; nxp.com; dkim=none (message not signed) header.d=none;nxp.com; dmarc=fail action=none header.from=nxp.com; Received-SPF: Fail (protection.outlook.com: domain of nxp.com does not designate 192.88.168.50 as permitted sender) receiver=protection.outlook.com; client-ip=192.88.168.50; helo=tx30smr01.am.freescale.net; Received: from tx30smr01.am.freescale.net (192.88.168.50) by BL2FFO11FD010.mail.protection.outlook.com (10.173.161.16) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.977.7 via Frontend Transport; Fri, 31 Mar 2017 05:29:47 +0000 Received: from Tophie.ap.freescale.net ([10.232.14.39]) by tx30smr01.am.freescale.net (8.14.3/8.14.0) with ESMTP id v2V5Thlb017482; Thu, 30 Mar 2017 22:29:44 -0700 From: Shreyansh Jain To: CC: , , , , Shreyansh Jain Date: Fri, 31 Mar 2017 11:05:35 +0530 Message-ID: <1490938537-1177-1-git-send-email-shreyansh.jain@nxp.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <11490938158-936-1-git-send-email-shreyansh.jain@nxp.com> References: <11490938158-936-1-git-send-email-shreyansh.jain@nxp.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131354117879234472; (91ab9b29-cfa4-454e-5278-08d120cd25b8); () X-Forefront-Antispam-Report: CIP:192.88.168.50; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(336005)(39450400003)(39400400002)(39850400002)(39410400002)(39860400002)(39840400002)(2980300002)(1109001)(1110001)(339900001)(189002)(199003)(9170700003)(47776003)(2351001)(54906002)(50226002)(8656002)(6666003)(8936002)(86362001)(50466002)(305945005)(356003)(104016004)(81166006)(48376002)(105606002)(106466001)(77096006)(8676002)(4326008)(33646002)(110136004)(38730400002)(36756003)(5003940100001)(189998001)(2950100002)(2906002)(5660300001)(6916009)(85426001)(76176999)(50986999)(53936002); DIR:OUT; SFP:1101; SCL:1; SRVR:BY2PR03MB395; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; MLV:ovrnspm; MX:1; A:1; PTR:InfoDomainNonexistent; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BL2FFO11FD010; 1:LcPi4jHc6OHQULPAjH8irZNQ2Zrm1fZKNn0cqoNlnpg2UOuZYZciBS5ZF1lp01T2WqGXdQBob3+TBVqx4aHybofLYoXjgYy8LuChW2gh+2Iv+7hzu+rvHgWVzvDOT/0hy4All8gNJrbJxWPoGZsrasSo0ZhE/+N095Sdau+G6/usC4sMzaDw4iEH52N/l/n+nrQhKcTkwXGSzK5g450xVJAiQ/Th07LfUlv68cAXT/lREn46AZdUavhzVs9N6t/9B+SQ8Xc3XvKeJcetO4sbcEf76TpHCt6tdUyZLqw4+hskCA5M5faROzIshOEWANZOzKtZTFbnmTPWS2/+FPnu+M76qHPVFfY6bQ2H5fGUohZTAxby2EOQvQu1IzFAhQ0a8jHMKEW3PmrrFWJvsD+nc8OlhSMEur6Gq2Nkrxgx49HewGcheeVNiGZW+Zr4JutvTQmu+1wNq6tGKepTbXQwj0Xy+QNExobu40XrGNj5P7WtJQWkeK4wM3iOZmZH/c8pCU4edsomQhDoDT3a50jON1RZWQoAnweS/Z2RAfOld2MgPVIzjkYlDwq6+uUrObhaL7pFb1Olw/D1VPyObPjlzKoSMAAO19CfjV0XswQ2SBV42RVduYkCtbMB/jYUS0AtDywNEWuTMbxzd/na81GLs0RHHrC9RW0IN1qefPu16ZFS9uLZBM1MV8FHU63UfD9NTPPQ9hocjMKRxpLTew2IPjWbBR+P1s8B05aRPxJixl2V9SEbwT/gxMPURKO1r3GY MIME-Version: 1.0 Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: 010277cc-50ce-43cf-ffa8-08d477f6f270 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(2017030255075)(201703131430075)(201703131517081); SRVR:BY2PR03MB395; X-Microsoft-Exchange-Diagnostics: 1; BY2PR03MB395; 3:3TWKR9jvheODnHiSz2v3pAHeuToyuVq4bzZkPq6AOCyMvXeJdu4NGYNVnwHQo6Qbh+7kzVlI3rnkPpycHUbzWma+bg1k0uSyrzWD/+OS0RvfP69paHXxLT4JZ0b5YSzqwyPqXRLilgUhUBknaQ7hxCdNwkGEIISywjnCiuZSs6vP7YsTg/5pAWZrrRz6ENBPwn/tIOogXxK/8x34KJYrPBNL4eZUdyDgbQQYKLw3CVNmghZNiLGEBsInaMqL9LNr4oJ1AB+8P+qm/g2wm8obHu9zCzD+tLF/3g1HIYWlQDOMoJJAwUzfaUKF/nng7j1+yKzCFBeQfqpn7sShwTnGPLPCQ2cSvbKHRSrAdS8aunnDsEcR/qxokWDSZUkMGduqHeTqyFxVWUiiCYCJIac6ZdszY9GRP6CpaA+MzFqA06tbLs3Sm7EBHYY0imMGgasKuRYC504npEm93/4lFwiMzQ==; 25:ouzFH8roesAMsJKvRR6JeioZp/3THAwTvT5RrgsL6OwgAjq4LG3/qwfyzh+w09YnxZUItk099wMQZQGHkufeaPF3KvEZ8yfOYKm6uC1hBv6BIOAUCwcnRJ/Smwpcot/3PVSt2xD8FINpo96uroMtITzPIuChNXZdplrJ9nTKyI9glya9tzg8BaS/p7T3TRPc80gVs1Hk3Mwd3cpyM2rPyOpL/4Cybyxjkua2k1d8AfeLYTW+Pht7aXKnTsGJj3pt58UxRwBwfVH/7TQBohP++3qG00UtJ8uLp+wtMcOZq/2Anzaz1mu8IwRxcVlDNog6TD5WnwPrk80fJQdRk9WQoEP3tJk4Q5eoW9AMAbs47d/hdKxJRPiJEFayw1xhT7r5C+DtJrBp+p3Zr2r6/tz+G79/gzfWmKgO4eir9D7NBCkxOL7mER+xvMxFOmdgetd4YYtd/IKCZifJimz5RgA4AA== X-Microsoft-Exchange-Diagnostics: 1; BY2PR03MB395; 31:PlpxysoeZR9DRY/9TSkpQaCSiuRudePUjMV5c+X21qtETxDVwPKIpuThw0cJTIc9w2R5Tunhx6y6CBBhSOcVkWv9Rz6UxIuJpfCLNIsuh+5ehJBUf75CZ5RYBtArAZXl443I2wbX7rzYzDRkEIS0WqCdCxRJKakgiEnPd6AHRF+e1AK0C3Bi7/eGjjpTmdsQRKi+GabP0hvAwnC3LbTCuIILzFfCKiibA4OpE4Cuk6t68jYmPMfhExnp4kJ34fo0wBIQz5/JkFULZQl0XBzBpQ== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(185117386973197); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6095135)(601004)(2401047)(13017025)(13023025)(13024025)(13015025)(8121501046)(5005006)(13018025)(3002001)(10201501046)(93006089)(93001089)(6055026)(6096035)(20161123556025)(20161123565025)(20161123563025)(201703131430075)(201703131448075)(201703131433075)(201703161259075)(20161123561025); SRVR:BY2PR03MB395; BCL:0; PCL:0; RULEID:(400006); SRVR:BY2PR03MB395; X-Microsoft-Exchange-Diagnostics: 1; BY2PR03MB395; 4:n2zLY5SMzIIqfJJ6A0md4rtnT4FXaXoZHS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?Q?ipDc5258qAEHc4EGa18u+sXE+nXCzbwb/VOeCp+sWjE2OalS3Nk+9vLmxHfn?= =?us-ascii?Q?yWG4ADH4djXWhNb3NjpJ5pWV4hy/mYXjgCZ/XG3VSjnIxA20AXNearFiPS91?= =?us-ascii?Q?T/U8RgAlR0jamglzW//nUL7yH22C4hV9TSeJBb69SCyigqZ8RSxYVgC9hpgX?= =?us-ascii?Q?sofOUNV+xFBSY=3D?= X-Microsoft-Exchange-Diagnostics: 1; BY2PR03MB395; 6:UZ6W/PJoVUOY3B+aCla8Kise30nof+qr8G69iC4H7yC4KukaShJuKbFRqVOOIKDOkdxnGRTTT91G7PnlAOrpTZKfpHJ0oOzJarldHsajAJTvMuJR5BggchmNUd5OQO7UzAa05PxqJFFOMcRpuwtHN98LimDG4y2Wd3z9GA87Ds5xX/iLtI+IRY7j5HhjncHjDYACOXdXf+ohORtuI/apKkWXHKysRa112hg6KMa0smGurjT/ZZtZQYevD56/sAejoOpv59CEvq8lyeTCz0OWZHD9KIHR2qX0EAdyaynChfR1nFIvY2lxa4zWw+7BO1RUK1mUyCXTaswUoLrwLIVSbD23HINCjCVVE1kyCXuDggyjDjpWzBngQSoR+3WcHJuegTqcBLygEgs7oHHFPPx2CA==; 5:PD1/aUUS3tXGXM7oHNMR7E/vz8VmYkbQuTg3DVpVnOz8zLPkm1a7FwRUtSZ3KhasdlaNjo7uH9CckzDn9PN2S/4zZoxnHVEM1fjpwoyrZTRHPfBpOkN5g6nxbFYR3ZBAdfb0E+5AIFSa47P8NkDAkaRWylGwR9NXv2eT17wQAsaC97Hx4lstRLdgnW8uI2qz; 24:07iNRmsIElG1EFvwF7y3cyB+GuBTQJtFUxvkmkylnYwjRrSKkCsMhAckk7fYIQM+gpVYgzfK/XBwm/BQcpSfNXkgLR/AlCZE/W7luCrQaFY= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BY2PR03MB395; 7:KRIeIxknPeZMDphzFQkHpFVPW2z56q3OqU42UFkLmezhvN2jDRxjgaw2xZKaiFeLOCt0mrh6njnpIT2tg/n/a1unuy7djv35KsqWB3caaFjcCgWXhsGVYpUDRV18WRcUPr7LR0V3UikTM5M7sqfjRUVPbVHEaNCdaRLnLFF98pATLTmLFh3R/pZort8onrYzHBKp5PEQNeDXskbBQlehPNx5q3VEQZAi/QhmkEliKcrxUqIJfZ1JLKIVO1FCXAHHCZMIsAK97elpuIO5lk1kOElc76UipwQsHeuRa2Vz8x80grvoaSYaD3y+HdkbtETfXHocWPub/Tw7z+4AFUcnpA== X-MS-Exchange-CrossTenant-OriginalArrivalTime: 31 Mar 2017 05:29:47.7362 (UTC) X-MS-Exchange-CrossTenant-Id: 5afe0b00-7697-4969-b663-5eab37d5f47e X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=5afe0b00-7697-4969-b663-5eab37d5f47e; Ip=[192.88.168.50]; Helo=[tx30smr01.am.freescale.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY2PR03MB395 Subject: [dpdk-dev] [PATCH v3 1/3] mempool: fix segfault when shared mempool handler not linked X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 31 Mar 2017 05:29:50 -0000 Fixes: 449c49b93a6b ("mempool: support handler operations") In case the stack or ring mempool handler are compiled as shared library and not linked in with test binary, segfault is reported. This is because return value of rte_mempool_set_ops_byname is not being checked in rte_mempool_ops_alloc. This patch handles error returned from rte_mempool_set_ops_byname when a mempool is not found. Signed-off-by: Shreyansh Jain --- v3: * resending as v2 didn't contain version * Added this fix after v1 as segault occurs when an unregistered mempool handler is requested lib/librte_mempool/rte_mempool.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/lib/librte_mempool/rte_mempool.c b/lib/librte_mempool/rte_mempool.c index 40d3afd..ef7d3d1 100644 --- a/lib/librte_mempool/rte_mempool.c +++ b/lib/librte_mempool/rte_mempool.c @@ -868,6 +868,7 @@ rte_mempool_create(const char *name, unsigned n, unsigned elt_size, rte_mempool_obj_cb_t *obj_init, void *obj_init_arg, int socket_id, unsigned flags) { + int ret; struct rte_mempool *mp; mp = rte_mempool_create_empty(name, n, elt_size, cache_size, @@ -880,13 +881,16 @@ rte_mempool_create(const char *name, unsigned n, unsigned elt_size, * set the correct index into the table of ops structs. */ if ((flags & MEMPOOL_F_SP_PUT) && (flags & MEMPOOL_F_SC_GET)) - rte_mempool_set_ops_byname(mp, "ring_sp_sc", NULL); + ret = rte_mempool_set_ops_byname(mp, "ring_sp_sc", NULL); else if (flags & MEMPOOL_F_SP_PUT) - rte_mempool_set_ops_byname(mp, "ring_sp_mc", NULL); + ret = rte_mempool_set_ops_byname(mp, "ring_sp_mc", NULL); else if (flags & MEMPOOL_F_SC_GET) - rte_mempool_set_ops_byname(mp, "ring_mp_sc", NULL); + ret = rte_mempool_set_ops_byname(mp, "ring_mp_sc", NULL); else - rte_mempool_set_ops_byname(mp, "ring_mp_mc", NULL); + ret = rte_mempool_set_ops_byname(mp, "ring_mp_mc", NULL); + + if (ret) + goto fail; /* call the mempool priv initializer */ if (mp_init) -- 2.7.4