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 73B5E4569C for ; Wed, 24 Jul 2024 13:33:47 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 6B2AC433B9; Wed, 24 Jul 2024 13:33:47 +0200 (CEST) Received: from mail-wm1-f41.google.com (mail-wm1-f41.google.com [209.85.128.41]) by mails.dpdk.org (Postfix) with ESMTP id 3A50942D28 for ; Wed, 24 Jul 2024 13:33:46 +0200 (CEST) Received: by mail-wm1-f41.google.com with SMTP id 5b1f17b1804b1-427ffae0b91so72115e9.0 for ; Wed, 24 Jul 2024 04:33:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1721820826; x=1722425626; darn=dpdk.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=24oVlIufBZpUjpB7itqmRALZU6PRbMdmFC4G36IIOcE=; b=edRjO/QRcL1pV3pugFPIf76Ti1vvNl3sB1Nyz2OMDR7H172ytA5YcNjG6X863YhpC2 O5gpjaCRUq3jpDAK3gfUtbDJhpT+3KhObEP8FGDg4Cl+vLu9w2T+8TunZVRDlVwUq+Gf sF7RPSw1N1n0u2ti0UojZ2Aa8GU9xdXwtues3JatyY+h/lb5eC08+49WiFm0pdUAcz/V 9Nt1VMVCqZY/jbCtT1aTW/E9oXkZpm7Ip0MNy97Ag+381Qb5WNFEqJmp2Q7yloUjmCF1 uzeu29IENyRKCvuzcYBOHX4QCIZXVSLS16t7OaKRlfyVn+fvWV2U0Sh6UaXSq5+A+vbz YH5w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721820826; x=1722425626; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=24oVlIufBZpUjpB7itqmRALZU6PRbMdmFC4G36IIOcE=; b=VIofFkoe42MFAwi8rPj2mB+FV5hWS30ChzgEsclndQKa20/5A25U6tGE2cwFXtv8aA XvQkq/4yXdmCfy+wsdYhO0Gaz86ARmo4QIZN7W4+Dy9yn+DiOgUz8au3FHMfYLx0S5wr Ac6K6aiQ14jxUj8hA5jLvnJm6evvk4JwtH4PJ9+G6Av99iMpkzeN478DAT3mj6V6arvr R8DJUF9q1ayXNhb2U2sjjVpJJPOZnq1Hvh4AejCF5bqqIcriPSjzfncGXCNxviL4YxQo XPP/2OYlBXXLhNKhX0GoWkBRIS5jD3Y4osIkAmjN+TdrI2oOZyQit+70M6vcaqHYokl0 izsA== X-Forwarded-Encrypted: i=1; AJvYcCUFGJZKQ/jV1wMrV181nlMbAcZTPfwbSkL+rbhXGIvHerCcULTRGd3Lhp6lkXMDsiSODVFvhWPTdb30A32ghCI= X-Gm-Message-State: AOJu0Yyy9Ggak6325e5ayUkSkHrsa3tWROAsMwcYpKXGw6bB/BH6lo9n 8ZofrIK+XDTpUvj+aE0lw82/KYQLX3rh/0h/ScYdrk8gN8dZICTU X-Google-Smtp-Source: AGHT+IGYkmaJPSJmJ/76KmYLxRIEOcOTjStfQ2dBkcC8bEqThm343OiT3P/w00KwY8EzJSxB/WCqjQ== X-Received: by 2002:a05:600c:870b:b0:426:5f09:cf53 with SMTP id 5b1f17b1804b1-427f7abb7efmr22891335e9.15.1721820825765; Wed, 24 Jul 2024 04:33:45 -0700 (PDT) Received: from localhost ([2a01:4b00:d036:ae00:7aef:1aaa:3dff:d546]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-427f93a8705sm24961455e9.32.2024.07.24.04.33.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Jul 2024 04:33:44 -0700 (PDT) From: luca.boccassi@gmail.com To: Vladimir Medvedkin Cc: Michael Theodore Stolarchuk , Bruce Richardson , dpdk stable Subject: patch 'net/ice: fix memory leaks in raw pattern parsing' has been queued to stable release 22.11.6 Date: Wed, 24 Jul 2024 12:32:47 +0100 Message-Id: <20240724113318.616754-9-luca.boccassi@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240724113318.616754-1-luca.boccassi@gmail.com> References: <20240715152704.2229503-86-luca.boccassi@gmail.com> <20240724113318.616754-1-luca.boccassi@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 Hi, FYI, your patch has been queued to stable release 22.11.6 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 07/26/24. 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/bluca/dpdk-stable This queued commit can be viewed at: https://github.com/bluca/dpdk-stable/commit/9928f1ec31182aba956b3d5e6f894eb7e97922b6 Thanks. Luca Boccassi --- >From 9928f1ec31182aba956b3d5e6f894eb7e97922b6 Mon Sep 17 00:00:00 2001 From: Vladimir Medvedkin Date: Mon, 22 Jul 2024 13:50:44 +0000 Subject: [PATCH] net/ice: fix memory leaks in raw pattern parsing [ upstream commit 8044e1d19db3d0012bd1348cb4fcf542d31cd41a ] This patch fixes possible memory leaks inside the ice_hash_parse_raw_pattern() due to the lack of a call to rte_free() for previously allocated pkt_buf and msk_buf. Fixes: 1b9c68120a1c ("net/ice: enable protocol agnostic flow offloading in RSS") Reported-by: Michael Theodore Stolarchuk Signed-off-by: Vladimir Medvedkin Acked-by: Bruce Richardson --- .mailmap | 1 + drivers/net/ice/ice_hash.c | 22 ++++++++++++++-------- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/.mailmap b/.mailmap index 9ee9365f8b..0398b858fb 100644 --- a/.mailmap +++ b/.mailmap @@ -915,6 +915,7 @@ Michael Santana Michael Savisko Michael Shamis Michael S. Tsirkin +Michael Theodore Stolarchuk Michael Wildt Michal Berger Michal Jastrzebski diff --git a/drivers/net/ice/ice_hash.c b/drivers/net/ice/ice_hash.c index 52646e9408..6fcfc5fc4c 100644 --- a/drivers/net/ice/ice_hash.c +++ b/drivers/net/ice/ice_hash.c @@ -657,7 +657,7 @@ ice_hash_parse_raw_pattern(struct ice_adapter *ad, uint8_t *pkt_buf, *msk_buf; uint8_t tmp_val = 0; uint8_t tmp_c = 0; - int i, j; + int i, j, ret = 0; if (ad->psr == NULL) return -rte_errno; @@ -677,8 +677,10 @@ ice_hash_parse_raw_pattern(struct ice_adapter *ad, return -ENOMEM; msk_buf = rte_zmalloc(NULL, pkt_len, 0); - if (!msk_buf) + if (!msk_buf) { + rte_free(pkt_buf); return -ENOMEM; + } /* convert string to int array */ for (i = 0, j = 0; i < spec_len; i += 2, j++) { @@ -715,18 +717,22 @@ ice_hash_parse_raw_pattern(struct ice_adapter *ad, msk_buf[j] = tmp_val * 16 + tmp_c - '0'; } - if (ice_parser_run(ad->psr, pkt_buf, pkt_len, &rslt)) - return -rte_errno; + ret = ice_parser_run(ad->psr, pkt_buf, pkt_len, &rslt); + if (ret) + goto free_mem; - if (ice_parser_profile_init(&rslt, pkt_buf, msk_buf, - pkt_len, ICE_BLK_RSS, true, &prof)) - return -rte_errno; + ret = ice_parser_profile_init(&rslt, pkt_buf, msk_buf, + pkt_len, ICE_BLK_RSS, true, &prof); + if (ret) + goto free_mem; rte_memcpy(&meta->raw.prof, &prof, sizeof(prof)); +free_mem: rte_free(pkt_buf); rte_free(msk_buf); - return 0; + + return ret; } static void -- 2.39.2 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2024-07-24 12:29:21.494044552 +0100 +++ 0009-net-ice-fix-memory-leaks-in-raw-pattern-parsing.patch 2024-07-24 12:29:20.675024200 +0100 @@ -1 +1 @@ -From 8044e1d19db3d0012bd1348cb4fcf542d31cd41a Mon Sep 17 00:00:00 2001 +From 9928f1ec31182aba956b3d5e6f894eb7e97922b6 Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit 8044e1d19db3d0012bd1348cb4fcf542d31cd41a ] + @@ -11 +12,0 @@ -Cc: stable@dpdk.org @@ -22 +23 @@ -index a6088813cc..541ca895a4 100644 +index 9ee9365f8b..0398b858fb 100644 @@ -25 +26 @@ -@@ -978,6 +978,7 @@ Michael Santana +@@ -915,6 +915,7 @@ Michael Santana @@ -34 +35 @@ -index f923641533..6b3095e2c5 100644 +index 52646e9408..6fcfc5fc4c 100644 @@ -37 +38 @@ -@@ -650,7 +650,7 @@ ice_hash_parse_raw_pattern(struct ice_adapter *ad, +@@ -657,7 +657,7 @@ ice_hash_parse_raw_pattern(struct ice_adapter *ad, @@ -46 +47 @@ -@@ -670,8 +670,10 @@ ice_hash_parse_raw_pattern(struct ice_adapter *ad, +@@ -677,8 +677,10 @@ ice_hash_parse_raw_pattern(struct ice_adapter *ad, @@ -58 +59 @@ -@@ -708,18 +710,22 @@ ice_hash_parse_raw_pattern(struct ice_adapter *ad, +@@ -715,18 +717,22 @@ ice_hash_parse_raw_pattern(struct ice_adapter *ad,