Commit 23aa2ad4 authored by Mark Hounschell's avatar Mark Hounschell Committed by Greg Kroah-Hartman

staging: dgap: Fix BUG in processing config file

This patch fixes an OOPS caused by a pointer being
changed between the malloc and free.
Signed-off-by: default avatarMark Hounschell <markh@compro.net>
Tested-by: default avatarMark Hounschell <markh@compro.net>
Reported-by: default avatarMark Hounschell <markh@compro.net>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 077c28f8
......@@ -820,6 +820,7 @@ static int dgap_firmware_load(struct pci_dev *pdev, int card_type)
{
struct board_t *brd = dgap_Board[dgap_NumBoards - 1];
const struct firmware *fw;
char *tmp_ptr;
int ret;
dgap_get_vpd(brd);
......@@ -843,7 +844,14 @@ static int dgap_firmware_load(struct pci_dev *pdev, int card_type)
memcpy(dgap_config_buf, fw->data, fw->size);
release_firmware(fw);
if (dgap_parsefile(&dgap_config_buf, TRUE) != 0) {
/*
* preserve dgap_config_buf
* as dgap_parsefile would
* otherwise alter it.
*/
tmp_ptr = dgap_config_buf;
if (dgap_parsefile(&tmp_ptr, TRUE) != 0) {
kfree(dgap_config_buf);
return -EINVAL;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment