Message ID | 20200624122701.1369327-2-maxime.coquelin@redhat.com (mailing list archive) |
---|---|
State | Superseded, archived |
Delegated to: | Maxime Coquelin |
Headers |
Return-Path: <dev-bounces@dpdk.org> X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 10218A0350; Wed, 24 Jun 2020 14:27:38 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id B52401D8FB; Wed, 24 Jun 2020 14:27:35 +0200 (CEST) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) by dpdk.org (Postfix) with ESMTP id F3AF21D8F4 for <dev@dpdk.org>; Wed, 24 Jun 2020 14:27:33 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1593001653; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=XT5uGVn4sUr1KhGhcRk1YIvJybNa87Z9+nQHYBzS/vM=; b=HReWQOvjVgzQdQtf35nCOiRZHruR9TCIIUTjy7rSW+3SXnP4Hywpr3In74ST83AQTPUvE1 XKkUqNIfwlmq2DDObcfXDkWwFiT9Gd92K3LmcVkMYTT3JC2JsMYnJcV6iCgwemEFkI0MnM opSH4Fl6W4FVnL82S3hC011d9Iku8v8= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-490-b3mqHC_rPS61iLr1zQ5m-g-1; Wed, 24 Jun 2020 08:27:30 -0400 X-MC-Unique: b3mqHC_rPS61iLr1zQ5m-g-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 4878D8015F7; Wed, 24 Jun 2020 12:27:28 +0000 (UTC) Received: from localhost.localdomain (unknown [10.36.110.7]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2ACD78929D; Wed, 24 Jun 2020 12:27:24 +0000 (UTC) From: Maxime Coquelin <maxime.coquelin@redhat.com> To: matan@mellanox.com, xiao.w.wang@intel.com, zhihong.wang@intel.com, chenbo.xia@intel.com, david.marchand@redhat.com, amorenoz@redhat.com, viacheslavo@mellanox.com, hemant.agrawal@nxp.com, sachin.saxena@nxp.com, grive@u256.net, dev@dpdk.org Cc: Maxime Coquelin <maxime.coquelin@redhat.com>, stable@dpdk.org, shreyansh.jain@nxp.com Date: Wed, 24 Jun 2020 14:26:45 +0200 Message-Id: <20200624122701.1369327-2-maxime.coquelin@redhat.com> In-Reply-To: <20200624122701.1369327-1-maxime.coquelin@redhat.com> References: <20200624122701.1369327-1-maxime.coquelin@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH v2 01/14] bus/dpaa: fix null pointer dereference X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions <dev.dpdk.org> List-Unsubscribe: <https://mails.dpdk.org/options/dev>, <mailto:dev-request@dpdk.org?subject=unsubscribe> List-Archive: <http://mails.dpdk.org/archives/dev/> List-Post: <mailto:dev@dpdk.org> List-Help: <mailto:dev-request@dpdk.org?subject=help> List-Subscribe: <https://mails.dpdk.org/listinfo/dev>, <mailto:dev-request@dpdk.org?subject=subscribe> Errors-To: dev-bounces@dpdk.org Sender: "dev" <dev-bounces@dpdk.org> |
Series |
vDPA API and framework rework
|
|
Checks
Context | Check | Description |
---|---|---|
ci/checkpatch | success | coding style OK |
Commit Message
Maxime Coquelin
June 24, 2020, 12:26 p.m. UTC
This patches fixes a null pointer derefencing that happens
when the device string passed to the iterator is NULL. This
situation can happen when iterating on a class type.
For example:
RTE_DEV_FOREACH(dev, "class=eth", &dev_iter) {
...
}
Fixes: e79df833d3f6 ("bus/dpaa: support hotplug ops")
Cc: stable@dpdk.org
Cc: shreyansh.jain@nxp.com
Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
---
drivers/bus/dpaa/dpaa_bus.c | 5 +++++
1 file changed, 5 insertions(+)
Comments
On 6/24/20 2:26 PM, Maxime Coquelin wrote: > This patches fixes a null pointer derefencing that happens > when the device string passed to the iterator is NULL. This > situation can happen when iterating on a class type. > For example: > > RTE_DEV_FOREACH(dev, "class=eth", &dev_iter) { > ... > } > > Fixes: e79df833d3f6 ("bus/dpaa: support hotplug ops") > Cc: stable@dpdk.org > Cc: shreyansh.jain@nxp.com > > Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com> > --- > drivers/bus/dpaa/dpaa_bus.c | 5 +++++ > 1 file changed, 5 insertions(+) > > diff --git a/drivers/bus/dpaa/dpaa_bus.c b/drivers/bus/dpaa/dpaa_bus.c > index d53fe6083a..216f38acd4 100644 > --- a/drivers/bus/dpaa/dpaa_bus.c > +++ b/drivers/bus/dpaa/dpaa_bus.c > @@ -703,6 +703,11 @@ dpaa_bus_dev_iterate(const void *start, const char *str, > struct rte_dpaa_device *dev; > char *dup, *dev_name = NULL; > > + if (str == NULL) { > + DPAA_BUS_DEBUG("No device string\n"); > + return NULL; > + } > + nitpicky: technically the trailing "\n" is not needed. Feel free to ignore > /* Expectation is that device would be name=device_name */ > if (strncmp(str, "name=", 5) != 0) { > DPAA_BUS_DEBUG("Invalid device string (%s)\n", str); > Acked-by: Adrián Moreno <amorenoz@redhat.com>
On 6/26/20 12:13 PM, Adrian Moreno wrote: > > > On 6/24/20 2:26 PM, Maxime Coquelin wrote: >> This patches fixes a null pointer derefencing that happens >> when the device string passed to the iterator is NULL. This >> situation can happen when iterating on a class type. >> For example: >> >> RTE_DEV_FOREACH(dev, "class=eth", &dev_iter) { >> ... >> } >> >> Fixes: e79df833d3f6 ("bus/dpaa: support hotplug ops") >> Cc: stable@dpdk.org >> Cc: shreyansh.jain@nxp.com >> >> Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com> >> --- >> drivers/bus/dpaa/dpaa_bus.c | 5 +++++ >> 1 file changed, 5 insertions(+) >> >> diff --git a/drivers/bus/dpaa/dpaa_bus.c b/drivers/bus/dpaa/dpaa_bus.c >> index d53fe6083a..216f38acd4 100644 >> --- a/drivers/bus/dpaa/dpaa_bus.c >> +++ b/drivers/bus/dpaa/dpaa_bus.c >> @@ -703,6 +703,11 @@ dpaa_bus_dev_iterate(const void *start, const char *str, >> struct rte_dpaa_device *dev; >> char *dup, *dev_name = NULL; >> >> + if (str == NULL) { >> + DPAA_BUS_DEBUG("No device string\n"); >> + return NULL; >> + } >> + > nitpicky: technically the trailing "\n" is not needed. Feel free to ignore Thanks, I'll fix while applying. > >> /* Expectation is that device would be name=device_name */ >> if (strncmp(str, "name=", 5) != 0) { >> DPAA_BUS_DEBUG("Invalid device string (%s)\n", str); >> > > Acked-by: Adrián Moreno <amorenoz@redhat.com> >
diff --git a/drivers/bus/dpaa/dpaa_bus.c b/drivers/bus/dpaa/dpaa_bus.c index d53fe6083a..216f38acd4 100644 --- a/drivers/bus/dpaa/dpaa_bus.c +++ b/drivers/bus/dpaa/dpaa_bus.c @@ -703,6 +703,11 @@ dpaa_bus_dev_iterate(const void *start, const char *str, struct rte_dpaa_device *dev; char *dup, *dev_name = NULL; + if (str == NULL) { + DPAA_BUS_DEBUG("No device string\n"); + return NULL; + } + /* Expectation is that device would be name=device_name */ if (strncmp(str, "name=", 5) != 0) { DPAA_BUS_DEBUG("Invalid device string (%s)\n", str);