From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr0-f193.google.com (mail-wr0-f193.google.com [209.85.128.193]) by dpdk.org (Postfix) with ESMTP id 5F04C1B818 for ; Tue, 15 May 2018 15:47:47 +0200 (CEST) Received: by mail-wr0-f193.google.com with SMTP id y15-v6so198480wrg.11 for ; Tue, 15 May 2018 06:47:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=NjoeTN6tRrBviE0bpav2ZnTKRtBXqwx/k5RuyhLXBYQ=; b=XBYikSZXMDfpQ3f75yLXwSYCYjCCVVAUCeZ2PM2ATsGPtI5csebLTiNokyIHx65HfQ grRHLR+Z/WvJuIENmesIOgIo7JfjP+k2Xs9XRClRV/pua6THEJAMYEt6xKtyLPigZZHA 5K+A7wVndiqhvKzq27adjaCkBwEqtvnJ6BPa7LjkXCJw8YoB3NKQZAKv5UgYn6cjBShe ynlIcbARAhMweQB9yPtQmo/R/RZDDqUGgpuVABJjiTG2DTSaJEPEyjkexwHKE9cTzA+3 e28UDI9Zy5s1k9eczeo1otejJ9IL13ZrJDiNE1thE2mRCPycWCq4O7LVyIkJLUrqkNWN 9Mcg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=NjoeTN6tRrBviE0bpav2ZnTKRtBXqwx/k5RuyhLXBYQ=; b=CROVWNfr/PhB4EqJsy1TA2uVCXsvyOfixvUNRVaHfR7CA6ywzaPeiSYhpWv7abk+8c Z5w4XfNStHflySVvylXTSBKBH/E0mkvWwhsbWn/f0koiwMxxzmABB5RGBjgkSWp2UYbS 1Do7HIB8znfUNDx+6m8R/7K4fOZ30kcRiCPxITajjeE5mqPgE1T6WldG5LUZxpShNOYx XlmyD892Q5B0uhGcAsMybOxTIjwOwwMN5AbzZzRDRbERg1SM4Tn1sILkMLjSRmsP1K6b rvhCmOTmJ96XokBVrvrSCCeqvHeHuxCft2WgZY8Q77l/+rrWDZkmbBolHVxUHjDudVfc KduQ== X-Gm-Message-State: ALKqPwe3d/VJkBsUxA6QDhKG++OWKQ+yx27E8fcfBsuocn113BnN6biy c5n3YKqrMrwpAK7bmDwT/RY= X-Google-Smtp-Source: AB8JxZqov9o5Oo5H0AG3hTlsLx8VuwfAleU82fU5b0eCEgYxG/ZPjRvAl1oNU5vvBIa/XuzddTOWMQ== X-Received: by 2002:adf:a194:: with SMTP id u20-v6mr10189998wru.262.1526392067101; Tue, 15 May 2018 06:47:47 -0700 (PDT) Received: from localhost (slip139-92-244-193.lon.uk.prserv.net. [139.92.244.193]) by smtp.gmail.com with ESMTPSA id n73-v6sm144347wrb.18.2018.05.15.06.47.45 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 15 May 2018 06:47:46 -0700 (PDT) From: luca.boccassi@gmail.com To: Pablo de Lara Cc: Fan Zhang , dpdk stable Date: Tue, 15 May 2018 14:46:15 +0100 Message-Id: <20180515134731.9337-4-luca.boccassi@gmail.com> X-Mailer: git-send-email 2.14.2 In-Reply-To: <20180515134731.9337-1-luca.boccassi@gmail.com> References: <20180503110612.12146-2-luca.boccassi@gmail.com> <20180515134731.9337-1-luca.boccassi@gmail.com> Subject: [dpdk-stable] patch 'crypto/scheduler: set null pointer after freeing' has been queued to stable release 18.02.2 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 May 2018 13:47:47 -0000 Hi, FYI, your patch has been queued to stable release 18.02.2 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 05/16/18. So please shout if anyone has objections. Thanks. Luca Boccassi --- >>From e284bcea7f8b3260798d232cf261611763c4974a Mon Sep 17 00:00:00 2001 From: Pablo de Lara Date: Thu, 26 Apr 2018 16:09:49 +0100 Subject: [PATCH] crypto/scheduler: set null pointer after freeing [ upstream commit 06f0a569972bebe22feeffd92c283954abc08359 ] When freeing memory, pointers should be set to NULL, to avoid memory corruption/segmentation faults. Fixes: 31439ee72b2c ("crypto/scheduler: add API implementations") Fixes: 50e14527b9d1 ("crypto/scheduler: improve parameters parsing") Fixes: 57523e682bb7 ("crypto/scheduler: register operation functions") Fixes: a783aa634410 ("crypto/scheduler: add packet size based mode") Fixes: 4c07e0552f0a ("crypto/scheduler: add multicore scheduling mode") Signed-off-by: Pablo de Lara Acked-by: Fan Zhang --- drivers/crypto/scheduler/rte_cryptodev_scheduler.c | 8 ++++++-- drivers/crypto/scheduler/scheduler_multicore.c | 6 ++++-- drivers/crypto/scheduler/scheduler_pkt_size_distr.c | 4 +++- drivers/crypto/scheduler/scheduler_pmd_ops.c | 9 +++++++-- 4 files changed, 20 insertions(+), 7 deletions(-) diff --git a/drivers/crypto/scheduler/rte_cryptodev_scheduler.c b/drivers/crypto/scheduler/rte_cryptodev_scheduler.c index 140c8b418..ed574cc18 100644 --- a/drivers/crypto/scheduler/rte_cryptodev_scheduler.c +++ b/drivers/crypto/scheduler/rte_cryptodev_scheduler.c @@ -91,8 +91,10 @@ update_scheduler_capability(struct scheduler_ctx *sched_ctx) struct rte_cryptodev_capabilities tmp_caps[256] = { {0} }; uint32_t nb_caps = 0, i; - if (sched_ctx->capabilities) + if (sched_ctx->capabilities) { rte_free(sched_ctx->capabilities); + sched_ctx->capabilities = NULL; + } for (i = 0; i < sched_ctx->nb_slaves; i++) { struct rte_cryptodev_info dev_info; @@ -462,8 +464,10 @@ rte_cryptodev_scheduler_load_user_scheduler(uint8_t scheduler_id, sched_ctx->ops.option_set = scheduler->ops->option_set; sched_ctx->ops.option_get = scheduler->ops->option_get; - if (sched_ctx->private_ctx) + if (sched_ctx->private_ctx) { rte_free(sched_ctx->private_ctx); + sched_ctx->private_ctx = NULL; + } if (sched_ctx->ops.create_private_ctx) { int ret = (*sched_ctx->ops.create_private_ctx)(dev); diff --git a/drivers/crypto/scheduler/scheduler_multicore.c b/drivers/crypto/scheduler/scheduler_multicore.c index b2ce44ceb..15a57c3db 100644 --- a/drivers/crypto/scheduler/scheduler_multicore.c +++ b/drivers/crypto/scheduler/scheduler_multicore.c @@ -328,11 +328,13 @@ static int scheduler_create_private_ctx(struct rte_cryptodev *dev) { struct scheduler_ctx *sched_ctx = dev->data->dev_private; - struct mc_scheduler_ctx *mc_ctx; + struct mc_scheduler_ctx *mc_ctx = NULL; uint16_t i; - if (sched_ctx->private_ctx) + if (sched_ctx->private_ctx) { rte_free(sched_ctx->private_ctx); + sched_ctx->private_ctx = NULL; + } mc_ctx = rte_zmalloc_socket(NULL, sizeof(struct mc_scheduler_ctx), 0, rte_socket_id()); diff --git a/drivers/crypto/scheduler/scheduler_pkt_size_distr.c b/drivers/crypto/scheduler/scheduler_pkt_size_distr.c index 96bf01614..d09e849ae 100644 --- a/drivers/crypto/scheduler/scheduler_pkt_size_distr.c +++ b/drivers/crypto/scheduler/scheduler_pkt_size_distr.c @@ -334,8 +334,10 @@ scheduler_create_private_ctx(struct rte_cryptodev *dev) struct scheduler_ctx *sched_ctx = dev->data->dev_private; struct psd_scheduler_ctx *psd_ctx; - if (sched_ctx->private_ctx) + if (sched_ctx->private_ctx) { rte_free(sched_ctx->private_ctx); + sched_ctx->private_ctx = NULL; + } psd_ctx = rte_zmalloc_socket(NULL, sizeof(struct psd_scheduler_ctx), 0, rte_socket_id()); diff --git a/drivers/crypto/scheduler/scheduler_pmd_ops.c b/drivers/crypto/scheduler/scheduler_pmd_ops.c index 680c2afbe..147dc51e9 100644 --- a/drivers/crypto/scheduler/scheduler_pmd_ops.c +++ b/drivers/crypto/scheduler/scheduler_pmd_ops.c @@ -46,6 +46,7 @@ scheduler_attach_init_slave(struct rte_cryptodev *dev) sched_ctx->init_slave_names[i]); rte_free(sched_ctx->init_slave_names[i]); + sched_ctx->init_slave_names[i] = NULL; sched_ctx->nb_init_slaves -= 1; } @@ -261,11 +262,15 @@ scheduler_pmd_close(struct rte_cryptodev *dev) } } - if (sched_ctx->private_ctx) + if (sched_ctx->private_ctx) { rte_free(sched_ctx->private_ctx); + sched_ctx->private_ctx = NULL; + } - if (sched_ctx->capabilities) + if (sched_ctx->capabilities) { rte_free(sched_ctx->capabilities); + sched_ctx->capabilities = NULL; + } return 0; } -- 2.14.2