[Bug] qlogic/qlcnic: Report a potential use after free in qlcnic_probe

From: lyl2019
Date: Mon Mar 22 2021 - 11:20:11 EST


Hi,
my static analyzer tool reported a potential uaf in qlcnic_probe.

The problem file is drivers/net/ethernet/qlogic/qlcnic/qlcnic_main.c in
Linux Kernel-5.12-rc2.

In funtion qlcnic_probe around line 2623, it calls qlcnic_dcb_enable()
to enable adapter->dcb. But the adapter->dcb could be freed inside
this callee when qlcnic_dcb_attach(dcb) return non-zero.

Later the adapter->dcb is used by qlcnic_dcb_get_info(adapter->dcb)
and could cause a use after free.

Thanks for your time.