From cd816bd23683de5fecc0aeafaed9e2b850b70dd8 Mon Sep 17 00:00:00 2001 From: Andrei Borzenkov Date: Sat, 20 Jun 2015 23:38:18 +0300 Subject: [PATCH] disk/scsi: fix use after free Found by: Coverity scan. CID: 96713 --- grub-core/disk/scsi.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/grub-core/disk/scsi.c b/grub-core/disk/scsi.c index 92084d0f8..4c6923f8b 100644 --- a/grub-core/disk/scsi.c +++ b/grub-core/disk/scsi.c @@ -615,9 +615,10 @@ grub_scsi_open (const char *name, grub_disk_t disk) if (scsi->blocksize & (scsi->blocksize - 1) || !scsi->blocksize) { + grub_error (GRUB_ERR_IO, "invalid sector size %d", + scsi->blocksize); grub_free (scsi); - return grub_error (GRUB_ERR_IO, "invalid sector size %d", - scsi->blocksize); + return grub_errno; } for (disk->log_sector_size = 0; (1U << disk->log_sector_size) < scsi->blocksize;