]> git.baikalelectronics.ru Git - kernel.git/commit
dmaengine: idxd: fix cdev setup and free device lifetime issues
authorDave Jiang <dave.jiang@intel.com>
Thu, 15 Apr 2021 23:37:57 +0000 (16:37 -0700)
committerVinod Koul <vkoul@kernel.org>
Tue, 20 Apr 2021 11:13:53 +0000 (16:43 +0530)
commitc74be58b7b3a8f5d3082ecc02af82bfc758cdd84
treeae39a3758cd7b5f42998768bf11d8efaaa26a6cc
parentc320a0ac374d8b674f0029f90bffa3aed84c5790
dmaengine: idxd: fix cdev setup and free device lifetime issues

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: dfcb650c7779 ("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>
drivers/dma/idxd/cdev.c
drivers/dma/idxd/idxd.h
drivers/dma/idxd/init.c
drivers/dma/idxd/irq.c
drivers/dma/idxd/sysfs.c