diff options
| author | Mark Hounschell <markh@compro.net> | 2014-04-23 10:33:45 -0400 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2014-05-16 12:15:18 -0700 |
| commit | 23aa2ad4a6281a43a3836bfeac006d03a4a361a0 (patch) | |
| tree | 7f015c2d90dfde570f5d993515125c02542485df | |
| parent | 077c28f8c2f6d375bb7927c1f909df810776647b (diff) | |
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: Mark Hounschell <markh@compro.net>
Tested-by: Mark Hounschell <markh@compro.net>
Reported-by: Mark Hounschell <markh@compro.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
| -rw-r--r-- | drivers/staging/dgap/dgap.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/drivers/staging/dgap/dgap.c b/drivers/staging/dgap/dgap.c index e0b8d0f051cc..55a23b051e86 100644 --- a/drivers/staging/dgap/dgap.c +++ b/drivers/staging/dgap/dgap.c @@ -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; } |
