Re: [PATCH v1 08/18] vfio/ccw: Check that private pointer is not NULL

Jason Gunthorpe
2022-06-02T19:06:01Z

On Thu, Jun 02, 2022 at 07:19:38PM +0200, Eric Farman wrote:
> The subchannel->dev->drvdata pointer is set in vfio_ccw_sch_probe()
> and cleared in vfio_ccw_sch_remove(). In a purely defensive move,
> let's check that the resultant pointer exists before operating on it
> any way, since some lifecycle changes are forthcoming.

There should be no possibility for the drvdata to be NULL in any of
these routines, if that happens there is some kernel race bug with
removal.

Thus all of these should be WARN_ON to document that they cannot happen.

Jason