Skip to content

Commit 9d8a99c

Browse files
nifeykuba-moo
authored andcommitted
qlcnic: fix memory leak in qlcnic_sriov_channel_cfg_cmd()
In one of the error paths in qlcnic_sriov_channel_cfg_cmd(), the memory allocated in qlcnic_sriov_alloc_bc_mbx_args() for mailbox arguments is not freed. Fix that by jumping to the error path that frees them, by calling qlcnic_free_mbx_args(). This was found using static analysis. Fixes: f197a7a ("qlcnic: VF-PF communication channel implementation") Signed-off-by: Abdun Nihaal <abdun.nihaal@gmail.com> Reviewed-by: Simon Horman <horms@kernel.org> Link: https://patch.msgid.link/20250512044829.36400-1-abdun.nihaal@gmail.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
1 parent d5c17e3 commit 9d8a99c

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_common.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1484,8 +1484,11 @@ static int qlcnic_sriov_channel_cfg_cmd(struct qlcnic_adapter *adapter, u8 cmd_o
14841484
}
14851485

14861486
cmd_op = (cmd.rsp.arg[0] & 0xff);
1487-
if (cmd.rsp.arg[0] >> 25 == 2)
1488-
return 2;
1487+
if (cmd.rsp.arg[0] >> 25 == 2) {
1488+
ret = 2;
1489+
goto out;
1490+
}
1491+
14891492
if (cmd_op == QLCNIC_BC_CMD_CHANNEL_INIT)
14901493
set_bit(QLC_BC_VF_STATE, &vf->state);
14911494
else

0 commit comments

Comments
 (0)