diff options
| author | aalok <none@none> | 2008-06-03 14:12:55 -0700 |
|---|---|---|
| committer | aalok <none@none> | 2008-06-03 14:12:55 -0700 |
| commit | a423e759b1b3e58affccafde9c320c61d7566a21 (patch) | |
| tree | a1b813a115342d268cae1767c1df431ea25f0ab3 /usr/src | |
| parent | 18061c656cfeed11077d5725b11f34c879cd7f6c (diff) | |
| download | illumos-joyent-a423e759b1b3e58affccafde9c320c61d7566a21.tar.gz | |
6694129 lofiadm -U always works
6694813 lofiadm -fd on a compressed file can leak memory
Diffstat (limited to 'usr/src')
| -rw-r--r-- | usr/src/cmd/lofiadm/main.c | 8 | ||||
| -rw-r--r-- | usr/src/uts/common/io/lofi.c | 11 |
2 files changed, 9 insertions, 10 deletions
diff --git a/usr/src/cmd/lofiadm/main.c b/usr/src/cmd/lofiadm/main.c index 22fd0d6bea..7a1f567407 100644 --- a/usr/src/cmd/lofiadm/main.c +++ b/usr/src/cmd/lofiadm/main.c @@ -404,9 +404,9 @@ lofi_uncompress(int lfd, const char *filename) /* If the file isn't compressed, we just return */ if ((ioctl(lfd, LOFI_CHECK_COMPRESSED, &li) == -1) || - (li.li_algorithm == '\0')) { + (li.li_algorithm[0] == '\0')) { delete_mapping(lfd, devicename, filename, B_TRUE); - return; + die("%s is not compressed\n", filename); } if ((compfd = open64(devicename, O_RDONLY | O_NONBLOCK)) == -1) { @@ -426,7 +426,7 @@ lofi_uncompress(int lfd, const char *filename) delete_mapping(lfd, devicename, filename, B_TRUE); free(dir); free(file); - return; + die("%s could not be uncompressed\n", filename); } /* @@ -441,7 +441,7 @@ lofi_uncompress(int lfd, const char *filename) delete_mapping(lfd, devicename, filename, B_TRUE); free(dir); free(file); - return; + die("%s could not be uncompressed\n", filename); } /* Now read from the device in MAXBSIZE-sized chunks */ diff --git a/usr/src/uts/common/io/lofi.c b/usr/src/uts/common/io/lofi.c index 5e33149e82..61d3e941ca 100644 --- a/usr/src/uts/common/io/lofi.c +++ b/usr/src/uts/common/io/lofi.c @@ -101,7 +101,6 @@ #include <sys/types.h> #include <netinet/in.h> #include <sys/sysmacros.h> -#include <sys/cmn_err.h> #include <sys/uio.h> #include <sys/kmem.h> #include <sys/cred.h> @@ -254,6 +253,11 @@ lofi_free_handle(dev_t dev, minor_t minor, struct lofi_state *lsp, kstat_delete(lsp->ls_kstat); mutex_destroy(&lsp->ls_kstat_lock); } + + if (lsp->ls_uncomp_seg_sz > 0) { + kmem_free(lsp->ls_comp_index_data, lsp->ls_comp_index_data_sz); + lsp->ls_uncomp_seg_sz = 0; + } ddi_soft_state_free(lofi_statep, minor); } @@ -1456,11 +1460,6 @@ lofi_unmap_file(dev_t dev, struct lofi_ioctl *ulip, int byfilename, return (EBUSY); } - if (lsp->ls_uncomp_seg_sz > 0) { - kmem_free(lsp->ls_comp_index_data, lsp->ls_comp_index_data_sz); - lsp->ls_uncomp_seg_sz = 0; - } - lofi_free_handle(dev, minor, lsp, credp); klip->li_minor = minor; |
