DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH] hash: fix segfault by adding param name NULL check
@ 2023-07-06 15:26 Conor Fogarty
  2024-03-01 17:16 ` Vladimir Medvedkin
  2024-06-14 13:47 ` David Marchand
  0 siblings, 2 replies; 3+ messages in thread
From: Conor Fogarty @ 2023-07-06 15:26 UTC (permalink / raw)
  To: dev; +Cc: Conor Fogarty, pablo.de.lara.guarch

Add NULL pointer check to params->name, which is later
copied into the hash datastructure. Without this check
the code segfaults on the strlcpy() of a NULL pointer.

Fixes: 48a399119619 ("hash: replace with cuckoo hash implementation")

Signed-off-by: Conor Fogarty <conor.fogarty@intel.com>

---
Cc: pablo.de.lara.guarch@intel.com
---
 lib/hash/rte_cuckoo_hash.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/lib/hash/rte_cuckoo_hash.c b/lib/hash/rte_cuckoo_hash.c
index d92a903bb3..0aab091c4d 100644
--- a/lib/hash/rte_cuckoo_hash.c
+++ b/lib/hash/rte_cuckoo_hash.c
@@ -166,6 +166,7 @@ rte_hash_create(const struct rte_hash_parameters *params)
 	/* Check for valid parameters */
 	if ((params->entries > RTE_HASH_ENTRIES_MAX) ||
 			(params->entries < RTE_HASH_BUCKET_ENTRIES) ||
+			(params->name == NULL) ||
 			(params->key_len == 0)) {
 		rte_errno = EINVAL;
 		RTE_LOG(ERR, HASH, "rte_hash_create has invalid parameters\n");
-- 
2.25.1

--------------------------------------------------------------
Intel Research and Development Ireland Limited
Registered in Ireland
Registered Office: Collinstown Industrial Park, Leixlip, County Kildare
Registered Number: 308263


This e-mail and any attachments may contain confidential material for the sole
use of the intended recipient(s). Any review or distribution by others is
strictly prohibited. If you are not the intended recipient, please contact the
sender and delete all copies.


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] hash: fix segfault by adding param name NULL check
  2023-07-06 15:26 [PATCH] hash: fix segfault by adding param name NULL check Conor Fogarty
@ 2024-03-01 17:16 ` Vladimir Medvedkin
  2024-06-14 13:47 ` David Marchand
  1 sibling, 0 replies; 3+ messages in thread
From: Vladimir Medvedkin @ 2024-03-01 17:16 UTC (permalink / raw)
  To: Conor Fogarty; +Cc: dev, pablo.de.lara.guarch, Medvedkin, Vladimir, stable

[-- Attachment #1: Type: text/plain, Size: 1858 bytes --]

+cc stable@

Acked-by: Vladimir Medvedkin <vladimir.medvedkin@intel.com>

чт, 6 июл. 2023 г. в 16:26, Conor Fogarty <conor.fogarty@intel.com>:

> Add NULL pointer check to params->name, which is later
> copied into the hash datastructure. Without this check
> the code segfaults on the strlcpy() of a NULL pointer.
>
> Fixes: 48a399119619 ("hash: replace with cuckoo hash implementation")
>
> Signed-off-by: Conor Fogarty <conor.fogarty@intel.com>
>
> ---
> Cc: pablo.de.lara.guarch@intel.com
> ---
>  lib/hash/rte_cuckoo_hash.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/lib/hash/rte_cuckoo_hash.c b/lib/hash/rte_cuckoo_hash.c
> index d92a903bb3..0aab091c4d 100644
> --- a/lib/hash/rte_cuckoo_hash.c
> +++ b/lib/hash/rte_cuckoo_hash.c
> @@ -166,6 +166,7 @@ rte_hash_create(const struct rte_hash_parameters
> *params)
>         /* Check for valid parameters */
>         if ((params->entries > RTE_HASH_ENTRIES_MAX) ||
>                         (params->entries < RTE_HASH_BUCKET_ENTRIES) ||
> +                       (params->name == NULL) ||
>                         (params->key_len == 0)) {
>                 rte_errno = EINVAL;
>                 RTE_LOG(ERR, HASH, "rte_hash_create has invalid
> parameters\n");
> --
> 2.25.1
>
> --------------------------------------------------------------
> Intel Research and Development Ireland Limited
> Registered in Ireland
> Registered Office: Collinstown Industrial Park, Leixlip, County Kildare
> Registered Number: 308263
>
>
> This e-mail and any attachments may contain confidential material for the
> sole
> use of the intended recipient(s). Any review or distribution by others is
> strictly prohibited. If you are not the intended recipient, please contact
> the
> sender and delete all copies.
>
>

-- 
Regards,
Vladimir

[-- Attachment #2: Type: text/html, Size: 2809 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] hash: fix segfault by adding param name NULL check
  2023-07-06 15:26 [PATCH] hash: fix segfault by adding param name NULL check Conor Fogarty
  2024-03-01 17:16 ` Vladimir Medvedkin
@ 2024-06-14 13:47 ` David Marchand
  1 sibling, 0 replies; 3+ messages in thread
From: David Marchand @ 2024-06-14 13:47 UTC (permalink / raw)
  To: Conor Fogarty; +Cc: dev, pablo.de.lara.guarch

On Thu, Jul 6, 2023 at 5:26 PM Conor Fogarty <conor.fogarty@intel.com> wrote:
>
> Add NULL pointer check to params->name, which is later
> copied into the hash datastructure. Without this check
> the code segfaults on the strlcpy() of a NULL pointer.
>
> Fixes: 48a399119619 ("hash: replace with cuckoo hash implementation")
Cc: stable@dpdk.org

>
> Signed-off-by: Conor Fogarty <conor.fogarty@intel.com>
Acked-by: Vladimir Medvedkin <vladimir.medvedkin@intel.com>

Applied, thanks.


-- 
David Marchand


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-06-14 13:48 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-06 15:26 [PATCH] hash: fix segfault by adding param name NULL check Conor Fogarty
2024-03-01 17:16 ` Vladimir Medvedkin
2024-06-14 13:47 ` David Marchand

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).