On Fri, Sep 16, 2022, at 2:10 AM, Christian Marangi wrote:
ADM dma engine has changed to also provide error pointer instaed of plain NULL pointer on invalid configuration of prep_slave_sg function. Currently this is not handled and an error pointer is detected as a valid dma_desc. This cause kernel panic as the driver doesn't fail with an invalid dma engine configuration.
Correctly handle this case by checking if dma_desc is NULL or IS_ERR.
Using IS_ERR_OR_NULL() is almost never a correct solution. I think in this case the problem is the adm_prep_slave_sg() function that returns an invalid error code.
While error pointers are often better than NULL pointers for passing information to the caller, a driver can't just change the calling conventions on its own. If we want to change the dmaengine_prep_slave_sg() API, I would suggest coming up with a new name for a replacement interface that uses error pointers instead of NULL first, and then changing all callers to the new interface.
Arnd