Date: Tue, 12 Sep 2017 14:18:45 +0000 (UTC) From: Toomas Soome <tsoome@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r323497 - head/sys/boot/efi/libefi Message-ID: <201709121418.v8CEIjX5053659@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: tsoome Date: Tue Sep 12 14:18:45 2017 New Revision: 323497 URL: https://svnweb.freebsd.org/changeset/base/323497 Log: libefi: efipart_open should check the status from disk_open In case of error from disk_open(), we should clean up properly. Reviewed by: allanjude, imp Differential Revision: https://reviews.freebsd.org/D12340 Modified: head/sys/boot/efi/libefi/efipart.c Modified: head/sys/boot/efi/libefi/efipart.c ============================================================================== --- head/sys/boot/efi/libefi/efipart.c Tue Sep 12 13:51:18 2017 (r323496) +++ head/sys/boot/efi/libefi/efipart.c Tue Sep 12 14:18:45 2017 (r323497) @@ -723,9 +723,20 @@ efipart_open(struct open_file *f, ...) pd->pd_bcache = bcache_allocate(); if (dev->d_dev->dv_type == DEVT_DISK) { - return (disk_open(dev, + int rc; + + rc = disk_open(dev, blkio->Media->BlockSize * (blkio->Media->LastBlock + 1), - blkio->Media->BlockSize)); + blkio->Media->BlockSize); + if (rc != 0) { + pd->pd_open--; + if (pd->pd_open == 0) { + pd->pd_blkio = NULL; + bcache_free(pd->pd_bcache); + pd->pd_bcache = NULL; + } + } + return (rc); } return (0); }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201709121418.v8CEIjX5053659>