staging: fsl-dpaa2/ethsw: fix memory leak of switchdev_work
authorColin Ian King <colin.king@canonical.com>
Sat, 8 Jun 2019 11:50:31 +0000 (12:50 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 9 Jun 2019 11:07:23 +0000 (13:07 +0200)
In the default event case switchdev_work is being leaked because
nothing is queued for work. Fix this by kfree'ing switchdev_work
before returning NOTIFY_DONE.

Addresses-Coverity: ("Resource leak")
Fixes: 44baaa43d7cc ("staging: fsl-dpaa2/ethsw: Add Freescale DPAA2 Ethernet Switch driver")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/fsl-dpaa2/ethsw/ethsw.c

index e3c3e427309ab020f082152085a280062d991a04..f73edaf6ce875fedd0197165795c5b3cdf56cb27 100644 (file)
@@ -1086,6 +1086,7 @@ static int port_switchdev_event(struct notifier_block *unused,
                dev_hold(dev);
                break;
        default:
+               kfree(switchdev_work);
                return NOTIFY_DONE;
        }