]> www.infradead.org Git - users/sagi/nvme-cli.git/commitdiff
plugins/micron: fix freed memory dereference.
authorMaurizio Lombardi <mlombard@redhat.com>
Tue, 8 Nov 2022 14:41:14 +0000 (15:41 +0100)
committerDaniel Wagner <dwagner@suse.de>
Wed, 9 Nov 2022 09:38:46 +0000 (10:38 +0100)
dev_close() is already called after the jump to "out".
Calling it 2 times against the same pointer is unsafe because
it will dereference freed memory.

Signed-off-by: Maurizio Lombardi <mlombard@redhat.com>
plugins/micron/micron-nvme.c

index e6f3a8cfc2254193451607bf0f71ed6ddaf2849c..3c0904c40aeae9dd1b350599bd6689d1c94b4dc1 100644 (file)
@@ -3168,7 +3168,6 @@ static int micron_internal_logs(int argc, char **argv, struct command *cmd,
     if (telemetry_option) {
         if ((ctrl.lpa & 0x8) != 0x8) {
            printf("telemetry option is not supported for specified drive\n");
-           dev_close(dev);
            goto out;
         }
         int logSize = 0; __u8 *buffer = NULL; const char *dir = ".";