Skip to content

Commit

Permalink
fpga manager: Fix firmware resource leak on error
Browse files Browse the repository at this point in the history
If fpga_mgr_buf_load() fails, the firmware resource previously allocated
by request_firmware() is leaked. Fix it by calling release_firmware()
regardless of the return value of fpga_mgr_buf_load().

Found by the Coverity scanner (CID 1339653).

Fixes: 6a8c3be ("add FPGA manager core")
Signed-off-by: Tobias Klauser <[email protected]>
Acked-by: Alan Tull <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
  • Loading branch information
tklauser authored and gregkh committed Nov 24, 2015
1 parent 07687c0 commit e8c77bd
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions drivers/fpga/fpga-mgr.c
Original file line number Diff line number Diff line change
Expand Up @@ -122,12 +122,10 @@ int fpga_mgr_firmware_load(struct fpga_manager *mgr, u32 flags,
}

ret = fpga_mgr_buf_load(mgr, flags, fw->data, fw->size);
if (ret)
return ret;

release_firmware(fw);

return 0;
return ret;
}
EXPORT_SYMBOL_GPL(fpga_mgr_firmware_load);

Expand Down

0 comments on commit e8c77bd

Please sign in to comment.