[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1427490069-3142-5-git-send-email-German.Rivera@freescale.com>
Date: Fri, 27 Mar 2015 16:01:07 -0500
From: "J. German Rivera" <German.Rivera@...escale.com>
To: <gregkh@...uxfoundation.org>, <arnd@...db.de>,
<devel@...verdev.osuosl.org>, <linux-kernel@...r.kernel.org>
CC: <stuart.yoder@...escale.com>, <Kim.Phillips@...escale.com>,
<scottwood@...escale.com>, <agraf@...e.de>,
<bhamciu1@...escale.com>, <R89243@...escale.com>,
<bhupesh.sharma@...escale.com>, <nir.erez@...escale.com>,
<richard.schmitt@...escale.com>,
"J. German Rivera" <German.Rivera@...escale.com>
Subject: [PATCH 4/6] staging: fsl-mc: Fix crash in fsl_mc_device_remove()
Only call fsl_mc_io_destroy() if the DPRC being removed
actually had an mc_io object associated with. Child DPRCs
that have not been bound to the DPRC driver or the VFIO driver
will not have an mc_io associated with them.
Signed-off-by: J. German Rivera <German.Rivera@...escale.com>
---
drivers/staging/fsl-mc/bus/dprc-driver.c | 9 ++-------
drivers/staging/fsl-mc/bus/mc-bus.c | 9 +++++----
2 files changed, 7 insertions(+), 11 deletions(-)
diff --git a/drivers/staging/fsl-mc/bus/dprc-driver.c b/drivers/staging/fsl-mc/bus/dprc-driver.c
index 9568eea..35c06cf 100644
--- a/drivers/staging/fsl-mc/bus/dprc-driver.c
+++ b/drivers/staging/fsl-mc/bus/dprc-driver.c
@@ -167,7 +167,6 @@ static void dprc_add_new_devices(struct fsl_mc_device *mc_bus_dev,
for (i = 0; i < num_child_objects_in_mc; i++) {
struct fsl_mc_device *child_dev;
- struct fsl_mc_io *mc_io = NULL;
struct dprc_obj_desc *obj_desc = &obj_desc_array[i];
if (strlen(obj_desc->type) == 0)
@@ -182,14 +181,10 @@ static void dprc_add_new_devices(struct fsl_mc_device *mc_bus_dev,
continue;
}
- error = fsl_mc_device_add(obj_desc, mc_io, &mc_bus_dev->dev,
+ error = fsl_mc_device_add(obj_desc, NULL, &mc_bus_dev->dev,
&child_dev);
- if (error < 0) {
- if (mc_io)
- fsl_destroy_mc_io(mc_io);
-
+ if (error < 0)
continue;
- }
}
}
diff --git a/drivers/staging/fsl-mc/bus/mc-bus.c b/drivers/staging/fsl-mc/bus/mc-bus.c
index de15fa9..d943d99 100644
--- a/drivers/staging/fsl-mc/bus/mc-bus.c
+++ b/drivers/staging/fsl-mc/bus/mc-bus.c
@@ -444,15 +444,16 @@ void fsl_mc_device_remove(struct fsl_mc_device *mc_dev)
put_device(&mc_dev->dev);
if (strcmp(mc_dev->obj_desc.type, "dprc") == 0) {
- struct fsl_mc_io *mc_io = mc_dev->mc_io;
-
mc_bus = to_fsl_mc_bus(mc_dev);
- fsl_destroy_mc_io(mc_io);
+ if (mc_dev->mc_io) {
+ fsl_destroy_mc_io(mc_dev->mc_io);
+ mc_dev->mc_io = NULL;
+ }
+
if (&mc_dev->dev == fsl_mc_bus_type.dev_root)
fsl_mc_bus_type.dev_root = NULL;
}
- mc_dev->mc_io = NULL;
if (mc_bus)
devm_kfree(mc_dev->dev.parent, mc_bus);
else
--
2.3.3
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists