linux/drivers/dma/idxd
Dave Jiang dd41a0e515 dmaengine: idxd: fix cdev setup and free device lifetime issues
[ Upstream commit 04922b7445 ]

The char device setup and cleanup has device lifetime issues regarding when
parts are initialized and cleaned up. The initialization of struct device is
done incorrectly. device_initialize() needs to be called on the 'struct
device' and then additional changes can be added. The ->release() function
needs to be setup via device_type before dev_set_name() to allow proper
cleanup. The change re-parents the cdev under the wq->conf_dev to get
natural reference inheritance. No known dependency on the old device path exists.

Reported-by: Jason Gunthorpe <jgg@nvidia.com>
Fixes: 42d279f913 ("dmaengine: idxd: add char driver to expose submission portal to userland")
Signed-off-by: Dave Jiang <dave.jiang@intel.com>
Reviewed-by: Dan Williams <dan.j.williams@intel.com>
Link: https://lore.kernel.org/r/161852987721.2203940.1478218825576630810.stgit@djiang5-desk3.ch.intel.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
History 2021-05-19 10:13:04 +02:00
..
cdev.c dmaengine: idxd: fix cdev setup and free device lifetime issues 2021-05-19 10:13:04 +02:00
device.c dmaengine: idxd: fix dma device lifetime 2021-05-19 10:13:04 +02:00
dma.c dmaengine: idxd: fix dma device lifetime 2021-05-19 10:13:04 +02:00
idxd.h dmaengine: idxd: fix cdev setup and free device lifetime issues 2021-05-19 10:13:04 +02:00
init.c dmaengine: idxd: fix cdev setup and free device lifetime issues 2021-05-19 10:13:04 +02:00
irq.c dmaengine: idxd: fix cdev setup and free device lifetime issues 2021-05-19 10:13:04 +02:00
Makefile dmaengine: idxd: add char driver to expose submission portal to userland 2020-01-24 11:18:45 +05:30
registers.h dmaengine: idxd: fix mapping of portal size 2020-11-16 22:38:20 +05:30
submit.c dmaengine: idxd: fix mapping of portal size 2020-11-16 22:38:20 +05:30
sysfs.c dmaengine: idxd: fix cdev setup and free device lifetime issues 2021-05-19 10:13:04 +02:00