Commit graph

391 commits

Author SHA1 Message Date
Leif Lindholm
51f375d688 efidisk: Respect block_io_protocol buffer alignment
Returned from the OpenProtocol operation, the grub_efi_block_io_media
structure contains the io_align field, specifying the minimum alignment
required for buffers used in any data transfers with the device.

Make grub_efidisk_readwrite() allocate a temporary buffer, aligned to
this boundary, if the buffer passed to it does not already meet the
requirements.

Also sanity check the io_align field in grub_efidisk_open() for
power-of-two-ness and bail if invalid.
2016-02-27 13:44:59 +01:00
Andrei Borzenkov
109189ce01 efidisk: fix misplaced parenthesis in b00e4c2 2016-02-27 15:16:48 +03:00
Andrei Borzenkov
b00e4c2bd9 efidisk: prevent errors from diskfilter scan of removable drives
Map EFI_NO_MEDIA to GRUB_ERR_OUT_OF_RANGE that is ignored by diskfilter. This
actually matches pretty close (we obviously attempt to read outside of media)
and avoids adding more error codes.

This affects only internally initiated scans. If read/write from removable is
explicitly requested, we still return an error and text explanation is more
clear for user than generic error.

Reported and tested by Andreas Loew <Andreas.Loew@gmx.net>
2016-02-26 21:44:37 +03:00
Colin Watson
95440b41d3 ahci, ehci: Fix typos 2016-01-16 20:37:15 +00:00
Andrei Borzenkov
e9d71db53a efidisk: fix memory leak
Found by: Coverity scan.
CID: 96644
2016-01-12 21:52:50 +03:00
Paulo Flabiano Smorigo
c899d9f42c ofdisk: add sas disks to the device list 2015-11-12 09:23:02 -02:00
Paulo Flabiano Smorigo
a50dbb743e ofdisk: add a comment about vscsi method 2015-11-10 21:20:20 -02:00
grub-devel@iam.tj
c7f93a20c4 cryptodisk: teach grub_cryptodisk_insert() about partitions (bug #45889)
It is not possible to configure encrypted containers on multiple partitions of
the same disk; after the first one all subsequent fail with

disk/cryptodisk.c:978: already mounted as crypto0

Store partition offset in cryptomount descriptor to distinguish between them.
2015-11-07 18:52:59 +03:00
Eric Snowberg
0b72543afd ofdisk: Fix devpath freeing logic. 2015-10-26 23:03:06 +01:00
Andrei Borzenkov
c93d3e6947 cryptodisk: strip parenthesis from backing device name
Otherwise subsequent disk open fails.

Reported-By: Klemens Nanni <contact@autoboot.org>
2015-09-13 20:12:31 +03:00
Felix Zielcke
8e3d2c80ed disk/ldm, partmap/msdos.c: fix spelling error 2015-08-22 21:22:41 +02:00
Vladimir Serbinenko
72fc110d95 ahci: Ensure that bus mastering is set.
Fixes ahci_test failing on several platforms.
2015-07-28 01:51:14 +02:00
Vladimir Serbinenko
389d509df0 diskfilter: Make name a const char to fix compilation error. 2015-07-22 20:39:14 +02:00
Vladimir Serbinenko
9f27f9f691 dmraid_nvidia: Set a name to usable value to avoid null dereference.
Reported by: Andrei Borzenkov
2015-07-22 01:57:40 +02:00
Andrei Borzenkov
cd816bd236 disk/scsi: fix use after free
Found by: Coverity scan.
CID: 96713
2015-06-20 23:38:18 +03:00
Paul Menzel
f4b1b48a83 disk/ahci.c: Use defines GRUB_AHCI_HBA_PORT_CMD_SPIN_UP and GRUB_AHCI_HBA_PORT_CMD_POWER_ON
Instead of hard coding `2` and `4` use the macros defined already at the
top of the file. As a consequence, wrap the now too long line.
2015-06-12 09:43:00 +03:00
Paul Menzel
ca59c24bd0 disk/ahci.c: Add port number to port debug messages
Currently, some messages cannot be mapped to the port they belong to as
the port number is missing from the output. So add `port: n` to the
debug messages.
2015-05-31 09:26:46 +03:00
Paul Menzel
fd73b3d008 Correct spelling of *scheduled*
Run the command below

	$ git grep -l schedulded | xargs sed -i 's/schedulded/scheduled/g'

and revert the change in `ChangeLog-2015`.

Including "miscellaneous" spelling fix noted by richardvoigt@gmail.com
2015-05-30 10:05:43 +03:00
Paul Menzel
5e74a3e6df disk/ahci: Use defines GRUB_ATA_STATUS_BUSY and GRUB_ATA_STATUS_DRQ
Instead of hard coding `0x88` use the macros defined in `disk/ata.h`.
2015-05-24 21:19:01 +03:00
Andrei Borzenkov
5082ea6184 remove extra newlines in grub_util_* strings
grub_util_{info,warn,error} already add trailing newlines, so remove
them from format strings. Also trailing full stops are already added.
2015-05-13 09:47:17 +03:00
Andrei Borzenkov
7b386b7031 efidisk: move device path helpers in core for efinet 2015-05-07 20:37:16 +03:00
Andrei Borzenkov
527eeeeee6 core: add LVM RAID1 support
Closes 44534.
2015-03-19 21:30:27 +03:00
Vladimir Serbinenko
87ec3b7fa9 Don't continue to query block-size if disk doesn't have it.
Stops poluting screen with a lot of "block-size: exception -21".
2015-03-03 20:50:37 +01:00
Vladimir Serbinenko
67a6a9512a raid6: Optimize by removing division. 2015-02-26 22:07:22 +01:00
Vladimir Serbinenko
f76c98b79e dmraid_nvidia: Fix division by 0 and missing byte-swap. 2015-02-26 22:06:19 +01:00
Vladimir Serbinenko
94f701a826 crypto: restrict cipher block size to power of 2.
All current ciphers have blocks which are power of 2 and it's
unlikely to change. Other block length would be tricky to handle anyway.
This restriction allows avoiding extra divisions.
2015-02-26 22:04:40 +01:00
Vladimir Serbinenko
967e5aa591 ofdisk: Exclude floppies from scanning.
It causes similar hang as CD on at least the qemu.
2015-02-21 16:16:48 +01:00
Andrei Borzenkov
8f5ebb1245 diskfilter_make_raid: more memory leaks in failure path 2015-02-15 10:14:07 +03:00
Vladimir Serbinenko
2ae9457e6e disk/lvm: Use zalloc to ensure that segments are initialised to sane value.
Reported by: EmanueL Czirai.
2015-02-14 20:31:00 +01:00
Andrei Borzenkov
fc535b32b9 diskfilter: fix double free of lv names for mdraid
Avoid micro-optimization in grub_diskfilter_make_raid and make sure
name and fullname are independent strings. This avoids need to special
case it everywhere else.

Also fix memory leak in failure case in grub_diskfilter_make_raid.

Closes: 41582
2015-02-14 19:08:58 +03:00
Andrei Borzenkov
e27fdbd686 diskfilter: fix crash in validate_lv for mdraid arrays
Commit 750f4bacd3 put LV validation before
actual vg assignment. Make grub_diskfilter_make_raid to assign ->vg as
happens in other cases for consistency. Also clean up redundant code and add
explicit NULL lv->vg check in validate_lv.

Also fix segment validation in validate_lv; it became obvious when crash
was fixed.

Closes: 44199
2015-02-14 17:56:01 +03:00
Vladimir Serbinenko
9ee5ae1fae Document intentional fallthroughs.
Found by: Coverity scan.
2015-01-27 17:17:58 +01:00
Vladimir Serbinenko
d1130afa5f biosdisk: Add missing cast.
Found by: Coverity scan.
2015-01-24 21:50:30 +01:00
Vladimir Serbinenko
7656b72b17 disk/geli: Add missing free.
Found by: Coverity scan.
2015-01-24 21:47:51 +01:00
Vladimir Serbinenko
6f43e350ed disk/geli: Add missing seek success check.
Found by: Coverity scan.
2015-01-24 21:46:23 +01:00
Vladimir Serbinenko
f2baeb194b disk/diskfilter: Add missing lv presence check.
Found by: Coverity scan.
2015-01-24 21:44:27 +01:00
Vladimir Serbinenko
4c7337bfe9 disk/cryptodisk: Add missing error check.
Found by: Coverity scan.
2015-01-24 21:38:22 +01:00
Vladimir Serbinenko
2a8200bba8 disk/ahci: Fix device_map_range argument.
Argument is not used on x86, hence it's gone unnoticed.

Found by: Coverity scan.
2015-01-24 21:37:28 +01:00
Vladimir Serbinenko
7d97335942 disk/AFsplitter: check argument validity before doing any allocs.
This avoids possible memory leaks.

Found by: Coverity scan.
2015-01-24 21:33:30 +01:00
Vladimir Serbinenko
7d027b4d3e efidisk: Return the determined root disk even if partition is unknown. 2015-01-24 19:53:13 +01:00
Andrey Borzenkov
2f73d2733c accept also hdX as alias to native Xen disk name
To be compatible with legacy pv-grub, sort disks by increasing order of handle
value. This allows reusing legacy pv-grub menu.lst which is using hdX names.

Suggested-By: Michael Chang <mchang@suse.com>
Closes: 44026
2015-01-23 19:52:45 +03:00
Vladimir Serbinenko
750f4bacd3 * grub-core/disk/diskfilter.c: Validate volumes to avoid division by zero. 2015-01-21 17:42:13 +01:00
Vladimir Serbinenko
4200ad44fe * grub-core/disk/i386/pc/biosdisk.c: Check disk size sanity. 2015-01-21 17:42:12 +01:00
Vladimir Serbinenko
f1959b1695 * grub-core/disk/ieee1275/nand.c (grub_nand_open): Check block size
validity.
2015-01-21 17:42:11 +01:00
Vladimir Serbinenko
935863518f grub_dmraid_nv_detect: Do not divide by zero. 2015-01-21 17:42:11 +01:00
Vladimir Serbinenko
f27ccb584c grub_ata_setaddress: Check that geometry is sane when using CHS addressing. 2015-01-21 17:42:10 +01:00
Vladimir Serbinenko
1dfe3f973e * grub-core/disk/AFSplitter.c (AF_merge): Check that mdlen is not 0. 2015-01-21 17:42:10 +01:00
Kris Moore
ba3031f996 Support GELI v6 and v7 2015-01-19 21:56:41 +03:00
Andrei Borzenkov
bbbcb791ed grub-core/disk/geli.c: fix memory leaks in error paths
CID: 73813, 73710
2014-11-28 22:23:30 +03:00
Andrei Borzenkov
ea44693fc8 grub-core/disk/luks.c: fix use after free and memory leaks
configure_ciphers:

- several memory leaks where allocated ciphers were not freed. CID: 73813,
73710

- use after free. It is probably quite innocent as grub is single threaded,
but could potentially be a problem with memory allocator debugger turned on.
CID: 73730

luks_recover_key:

- memory leak. CID: 73854
2014-11-28 21:12:00 +03:00