Bug 198860 - [patch] geli: Properly propagate errors in metadata reading
Summary: [patch] geli: Properly propagate errors in metadata reading
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: CURRENT
Hardware: Any Any
: --- Affects Many People
Assignee: freebsd-bugs mailing list
URL:
Keywords: patch
Depends on:
Blocks:
 
Reported: 2015-03-24 01:33 UTC by fullermd
Modified: 2015-07-02 10:58 UTC (History)
1 user (show)

See Also:


Attachments
Add error check (396 bytes, patch)
2015-03-24 01:33 UTC, fullermd
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description fullermd 2015-03-24 01:33:59 UTC
Created attachment 154744 [details]
Add error check

g_eli_read_metadata() doesn't check the return value of eli_metadata_read().  Because of that, if eli_metadata_read() fails, the g_eli_metadata struct passed isn't changed (and so probably contains garbage from the caller), but g_eli_read_metadata() returns success, so the caller will try using it.

The goto in the patch is redundant with the current code, but is added for symmetry with other earlier error checks, and for safety if anything else later gets added to the function.
Comment 1 commit-hook freebsd_committer 2015-07-02 10:58:06 UTC
A commit references this bug:

Author: pjd
Date: Thu Jul  2 10:57:35 UTC 2015
New revision: 285024
URL: https://svnweb.freebsd.org/changeset/base/285024

Log:
  Properly propagate errors in metadata reading.

  PR:		198860
  Submitted by:	Matthew D. Fuller

Changes:
  head/sys/geom/eli/g_eli.c