aboutsummaryrefslogtreecommitdiff
path: root/stand
diff options
context:
space:
mode:
authorWarner Losh <imp@FreeBSD.org>2022-10-21 23:39:34 +0000
committerWarner Losh <imp@FreeBSD.org>2023-01-24 21:49:36 +0000
commite2cc4bab4b001e419557c9692a918b29dd35e1e8 (patch)
treefef21c0cc1c137606f45950d6e095649fce82f22 /stand
parentcf39b45a30431ce84339970d30fbbf7e864af4de (diff)
downloadsrc-e2cc4bab4b001e419557c9692a918b29dd35e1e8.tar.gz
src-e2cc4bab4b001e419557c9692a918b29dd35e1e8.zip
stabd/geli: Bail out if you can't get the disks size
If the DIOCGMEDIASIZE ioctl fails, assume the disk doesn't have geli encryption. While all disks should implement this, fail safe for disks / partitions that do not. Sponsored by: Netflix (cherry picked from commit 787df454c8175e58131f582c05c169070fb6ca7c)
Diffstat (limited to 'stand')
-rw-r--r--stand/libsa/geli/gelidev.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/stand/libsa/geli/gelidev.c b/stand/libsa/geli/gelidev.c
index 5f1143399fb3..2dd686c81883 100644
--- a/stand/libsa/geli/gelidev.c
+++ b/stand/libsa/geli/gelidev.c
@@ -302,7 +302,8 @@ geli_probe_and_attach(struct open_file *f)
hdesc = (struct disk_devdesc *)(f->f_devdata);
/* Get the last block number for the host provider. */
- hdesc->dd.d_dev->dv_ioctl(f, DIOCGMEDIASIZE, &hmediasize);
+ if (hdesc->dd.d_dev->dv_ioctl(f, DIOCGMEDIASIZE, &hmediasize) != 0)
+ return;
hlastblk = (hmediasize / DEV_BSIZE) - 1;
/* Taste the host provider. If it's not geli-encrypted just return. */