[Xenomai] Analogy: subdev list not intitialized if driver private data is NULL
Andreas Glatz
andi.glatz at gmail.com
Thu Apr 10 10:58:55 CEST 2014
Currently my analogy driver for a new DAQ board doesn't need the
private data struct of the driver, so I set the size to 0:
/* Analogy driver structure */
static a4l_drv_t a4l_drv_pandadaq = {
.owner = THIS_MODULE,
.board_name = "analogy_pandadaq",
.attach = dev_pandadaq_attach,
.detach = dev_pandadaq_detach,
.privdata_size = 0,
};
However, due to a potential bug the kernel crashes with a NULL ptr
exception after linking analogy0 to my driver.
If I apply this patch to the git head of xenomai-2.6 everything works
for me:
diff --git a/ksrc/drivers/analogy/device.c b/ksrc/drivers/analogy/
device.c
index b93ae72..c4095a2 100644
--- a/ksrc/drivers/analogy/device.c
+++ b/ksrc/drivers/analogy/device.c
@@ -278,15 +278,14 @@ int a4l_assign_driver(a4l_cxt_t * cxt,
a4l_dev_t *dev = a4l_get_dev(cxt);
dev->driver = drv;
+
+ INIT_LIST_HEAD(&dev->subdvsq);
if (drv->privdata_size == 0)
__a4l_dbg(1, core_dbg,
"a4l_assign_driver: warning! "
"the field priv will not be usable\n");
else {
-
- INIT_LIST_HEAD(&dev->subdvsq);
-
dev->priv = rtdm_malloc(drv->privdata_size);
if (dev->priv == NULL && drv->privdata_size != 0) {
__a4l_err("a4l_assign_driver: "
A.
More information about the Xenomai
mailing list