aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCyril Bur <cyril.bur@au1.ibm.com>2016-11-11 15:13:02 +1100
committerStewart Smith <stewart@linux.vnet.ibm.com>2016-11-11 15:24:01 +1100
commit02a628a37982ebcc00f050d2a6a73aa6247718f2 (patch)
treeb68d1ffe6e6782d8aa75c62a4a327a10a7de3f52
parent4e4db1a8d9aa2369cefab7d70ef08dc9356ef514 (diff)
downloadskiboot-02a628a37982ebcc00f050d2a6a73aa6247718f2.zip
skiboot-02a628a37982ebcc00f050d2a6a73aa6247718f2.tar.gz
skiboot-02a628a37982ebcc00f050d2a6a73aa6247718f2.tar.bz2
external/pflash: Perform the correct cleanup
If the -F flag is used then pflash uses a regular file as the flash. On cleanup pflash fails to tell arch_flash_close() if it had passed a filename to arch_flash_init() as such arch_flash_close() assumes that it needs to close the actual flash structure and not simply a file descriptor leading to a NULL dereference. Signed-off-by: Cyril Bur <cyril.bur@au1.ibm.com> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
-rw-r--r--external/pflash/pflash.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/external/pflash/pflash.c b/external/pflash/pflash.c
index 9d4c6b2..2f9cc71 100644
--- a/external/pflash/pflash.c
+++ b/external/pflash/pflash.c
@@ -42,6 +42,7 @@
/* Full pflash version number (possibly includes gitid). */
extern const char version[];
+const char *flashfilename = NULL;
static bool must_confirm = true;
static bool dummy_run;
static int need_relock;
@@ -524,7 +525,7 @@ void exiting(void)
{
if (need_relock)
arch_flash_set_wrprotect(bl, 1);
- arch_flash_close(bl, NULL);
+ arch_flash_close(bl, flashfilename);
}
int main(int argc, char *argv[])
@@ -540,7 +541,6 @@ int main(int argc, char *argv[])
char *write_file = NULL, *read_file = NULL, *part_name = NULL;
bool ffs_toc_seen = false, direct = false;
int rc;
- const char *flashfilename = NULL;
while(1) {
struct option long_opts[] = {