From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 96D31A034F for ; Wed, 11 Aug 2021 12:20:08 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 904C140C35; Wed, 11 Aug 2021 12:20:08 +0200 (CEST) Received: from smtp-relay-canonical-0.canonical.com (smtp-relay-canonical-0.canonical.com [185.125.188.120]) by mails.dpdk.org (Postfix) with ESMTP id C014340C35 for ; Wed, 11 Aug 2021 12:20:06 +0200 (CEST) Received: from mail-qt1-f200.google.com (mail-qt1-f200.google.com [209.85.160.200]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-canonical-0.canonical.com (Postfix) with ESMTPS id 9D4623F0A9 for ; Wed, 11 Aug 2021 10:20:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1628677206; bh=GLy+3ST+gFxn+x3+q2CCRE+H6mi9nu0bWP2NhJ1/0kA=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=nVnT8ACE5tNRQ7namfEuUeGmtUYbFCBdiUt6gWJNbpplIV8CHE62L05iGWswsXoSi 65j9BmedMDq9xrcQXVASfFFyzqGpftsbtO6JRsltvDN9zgK4XsfK2e45EiyoH/Yfqt uYk+61dNNUil0Dcy0tY4ytmXFYThnrSEGveYyYsj5JOhnzcLi+joea6FxxKKjQlfd2 sSi4Ej21HOhzhMTNegUmr1niQBHfHPnv0Xqw0K0bxxiqTPHZjAC2ICaUdSP7BJwrqA +9uzJhQgBv+EMDg6nq7bdHDBYS0OzSghyBrhm/Ll/+qj672srjoRpU1evrVSq9nMcY T4VJ8XsD0c/+Q== Received: by mail-qt1-f200.google.com with SMTP id o11-20020ac85a4b0000b029028acd99a680so1040857qta.19 for ; Wed, 11 Aug 2021 03:20:06 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=GLy+3ST+gFxn+x3+q2CCRE+H6mi9nu0bWP2NhJ1/0kA=; b=kWZjdv/WDpHiXwPH7pbQjjr6HR6UxbriCAVMERxcvTK2uDBG8RdsydB6iDF97Idy2P CAQg8g8ZO8/bmYbc0zJ+r/uTrQ1FhW9vhMpblFp67n/G5BGMhj9e868e5HA79Na0BzsE aeBJz0407YM1rimZYDBHV5o+2rgswQSNZrZpQiX5LEi5y7sj8lUL/kfM71pKBxavMhhJ 3ynhAvNbpAviwrZ46nQRB5b87co1c+ih68Z8CJ1srR8rQugosXpDgPyBC3UxEI6ji4OH kkOs31ZlRWYKUIaJEISb3jyKFgquGNOeSEH8D7wA3d91Nh/hvUubND/Y9RtKWGLt0DdW P7IA== X-Gm-Message-State: AOAM530BlWpkgUvfj4v6q66auBS7LvTGY1muJCFgzQwx+WZktu4oRrDW oyxpIVaNQ3WF2MgSNGGCTKsn0HamGQuvR8Buy60eCS6PXpQENLXXBmQvnywla+yq7D5egrq9WWd W7+Ge6x79HCWcxhWG+7klb8WZvIgfNvdaaNTwB4Ob X-Received: by 2002:a37:a0c7:: with SMTP id j190mr16024115qke.418.1628677205413; Wed, 11 Aug 2021 03:20:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzdUDfCsHDuqOxIv+N62QMeU2dM5wejhIClZ5bRhBcyCcrlFWzavhGrgUA8jALL7Xm33WAyByqrMKFfLYU6WBU= X-Received: by 2002:a37:a0c7:: with SMTP id j190mr16024095qke.418.1628677205193; Wed, 11 Aug 2021 03:20:05 -0700 (PDT) MIME-Version: 1.0 References: <20210810154022.749358-1-christian.ehrhardt@canonical.com> <20210810154022.749358-79-christian.ehrhardt@canonical.com> In-Reply-To: <20210810154022.749358-79-christian.ehrhardt@canonical.com> From: Christian Ehrhardt Date: Wed, 11 Aug 2021 12:19:39 +0200 Message-ID: To: Dapeng Yu Cc: Jasvinder Singh , dpdk stable Content-Type: text/plain; charset="UTF-8" Subject: Re: [dpdk-stable] patch 'net/softnic: fix memory leak in arguments parsing' has been queued to stable release 19.11.10 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" On Tue, Aug 10, 2021 at 5:44 PM wrote: > > Hi, > > FYI, your patch has been queued to stable release 19.11.10 > Hi, while applying cleanly your patch caused build time failures like: [ 262s] if (rte_strscpy(p->firmware, SOFTNIC_FIRMWARE, [ 262s] ^ [ 262s] /home/abuild/rpmbuild/BUILD/dpdk-1628675870.0ca0a4945/drivers/net/softnic/rte_eth_softnic.c:451:2: error: nested extern declaration of 'rte_strscpy' [-Werror=nested-externs] [ 262s] /home/abuild/rpmbuild/BUILD/dpdk-1628675870.0ca0a4945/drivers/net/softnic/rte_eth_softnic.c: At top level: [ 262s] cc1: error: unrecognized command line option "-Wno-address-of-packed-member" [-Werror] Therefore the patch will be de-qeueud from the stable branch that shall become 19.11.10. Please consider having a look and providing a backport. A backport should contain a reference to the DPDK main branch commit in it's commit message in the following fashion: [ upstream commit ] For example: https://git.dpdk.org/dpdk-stable/commit/?h=18.11&id=d90e6ae6f936ecdc2fd3811ff9f26aec7f3c06eb When sending the backported patch, please indicate the target branch in the subject line, as we have multiple branches, for example: [PATCH 19.11] foo/bar: fix baz With git format-patch, this can be achieved by appending the parameter: --subject-prefix='PATCH 19.11' Send the backported patch to "stable@dpdk.org" but not "dev@dpdk.org". FYI, branch 19.11 is located at tree: https://git.dpdk.org/dpdk-stable Thanks in advance, Chrtistian > Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. > It will be pushed if I get no objections before 08/12/21. So please > shout if anyone has objections. > > Also note that after the patch there's a diff of the upstream commit vs the > patch applied to the branch. This will indicate if there was any rebasing > needed to apply to the stable branch. If there were code changes for rebasing > (ie: not only metadata diffs), please double check that the rebase was > correctly done. > > Queued patches are on a temporary branch at: > https://github.com/cpaelzer/dpdk-stable-queue > > This queued commit can be viewed at: > https://github.com/cpaelzer/dpdk-stable-queue/commit/d313979fd603c8c588822a675b328fd000e17734 > > Thanks. > > Christian Ehrhardt > > --- > From d313979fd603c8c588822a675b328fd000e17734 Mon Sep 17 00:00:00 2001 > From: Dapeng Yu > Date: Thu, 15 Jul 2021 13:38:14 +0800 > Subject: [PATCH] net/softnic: fix memory leak in arguments parsing > > [ upstream commit d8f852f5f3692bbf15743d1aca25e6abcbe652ad ] > > In function pmd_parse_args(), firmware path is duplicated from device > arguments as character string, but is never freed, which cause memory > leak. > > This patch changes the type of firmware member of struct pmd_params to > character array, to make memory resource release unnecessary, and > changes the type of name member to character array, to keep the > consistency of character string handling in struct pmd_params. > > Fixes: 7e68bc20f8c8 ("net/softnic: restructure") > > Signed-off-by: Dapeng Yu > Acked-by: Jasvinder Singh > --- > drivers/net/softnic/rte_eth_softnic.c | 30 ++++++++++++++++--- > .../net/softnic/rte_eth_softnic_internals.h | 5 ++-- > 2 files changed, 29 insertions(+), 6 deletions(-) > > diff --git a/drivers/net/softnic/rte_eth_softnic.c b/drivers/net/softnic/rte_eth_softnic.c > index 11723778fd..f4858255ce 100644 > --- a/drivers/net/softnic/rte_eth_softnic.c > +++ b/drivers/net/softnic/rte_eth_softnic.c > @@ -440,6 +440,7 @@ pmd_parse_args(struct pmd_params *p, const char *params) > { > struct rte_kvargs *kvlist; > int ret = 0; > + char *firmware = NULL; > > kvlist = rte_kvargs_parse(params, pmd_valid_args); > if (kvlist == NULL) > @@ -447,7 +448,14 @@ pmd_parse_args(struct pmd_params *p, const char *params) > > /* Set default values */ > memset(p, 0, sizeof(*p)); > - p->firmware = SOFTNIC_FIRMWARE; > + if (rte_strscpy(p->firmware, SOFTNIC_FIRMWARE, > + sizeof(p->firmware)) < 0) { > + PMD_LOG(WARNING, > + "\"%s\": firmware path should be shorter than %zu", > + SOFTNIC_FIRMWARE, sizeof(p->firmware)); > + ret = -EINVAL; > + goto out_free; > + } > p->cpu_id = SOFTNIC_CPU_ID; > p->sc = SOFTNIC_SC; > p->tm.n_queues = SOFTNIC_TM_N_QUEUES; > @@ -468,11 +476,20 @@ pmd_parse_args(struct pmd_params *p, const char *params) > /* Firmware script (optional) */ > if (rte_kvargs_count(kvlist, PMD_PARAM_FIRMWARE) == 1) { > ret = rte_kvargs_process(kvlist, PMD_PARAM_FIRMWARE, > - &get_string, &p->firmware); > + &get_string, &firmware); > if (ret < 0) > goto out_free; > } > - > + if (rte_strscpy(p->firmware, firmware, > + sizeof(p->firmware)) < 0) { > + PMD_LOG(WARNING, > + "\"%s\": firmware path should be shorter than %zu", > + firmware, sizeof(p->firmware)); > + free(firmware); > + ret = -EINVAL; > + goto out_free; > + } > + free(firmware); > /* Connection listening port (optional) */ > if (rte_kvargs_count(kvlist, PMD_PARAM_CONN_PORT) == 1) { > ret = rte_kvargs_process(kvlist, PMD_PARAM_CONN_PORT, > @@ -621,7 +638,12 @@ pmd_probe(struct rte_vdev_device *vdev) > if (status) > return status; > > - p.name = name; > + if (rte_strscpy(p.name, name, sizeof(p.name)) < 0) { > + PMD_LOG(WARNING, > + "\"%s\": device name should be shorter than %zu", > + name, sizeof(p.name)); > + return -EINVAL; > + } > > /* Allocate and initialize soft ethdev private data */ > dev_private = pmd_init(&p); > diff --git a/drivers/net/softnic/rte_eth_softnic_internals.h b/drivers/net/softnic/rte_eth_softnic_internals.h > index 6eec43b22b..f8549b2174 100644 > --- a/drivers/net/softnic/rte_eth_softnic_internals.h > +++ b/drivers/net/softnic/rte_eth_softnic_internals.h > @@ -28,14 +28,15 @@ > #include "conn.h" > > #define NAME_SIZE 64 > +#define SOFTNIC_PATH_MAX 4096 > > /** > * PMD Parameters > */ > > struct pmd_params { > - const char *name; > - const char *firmware; > + char name[NAME_SIZE]; > + char firmware[SOFTNIC_PATH_MAX]; > uint16_t conn_port; > uint32_t cpu_id; > int sc; /**< Service cores. */ > -- > 2.32.0 > > --- > Diff of the applied patch vs upstream commit (please double-check if non-empty: > --- > --- - 2021-08-10 15:11:16.063474888 +0200 > +++ 0079-net-softnic-fix-memory-leak-in-arguments-parsing.patch 2021-08-10 15:11:13.090638619 +0200 > @@ -1 +1 @@ > -From d8f852f5f3692bbf15743d1aca25e6abcbe652ad Mon Sep 17 00:00:00 2001 > +From d313979fd603c8c588822a675b328fd000e17734 Mon Sep 17 00:00:00 2001 > @@ -5,0 +6,2 @@ > +[ upstream commit d8f852f5f3692bbf15743d1aca25e6abcbe652ad ] > + > @@ -16 +17,0 @@ > -Cc: stable@dpdk.org > @@ -26 +27 @@ > -index f64023256d..0aa7147b13 100644 > +index 11723778fd..f4858255ce 100644 > @@ -91 +92 @@ > -index 1b3186ef0b..07285ca315 100644 > +index 6eec43b22b..f8549b2174 100644 -- Christian Ehrhardt Staff Engineer, Ubuntu Server Canonical Ltd