Bug 221846 - [regression] panic after r313351 due to NULL pointer dereference
Summary: [regression] panic after r313351 due to NULL pointer dereference
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: 11.1-STABLE
Hardware: Any Any
: --- Affects Some People
Assignee: Edward Tomasz Napierala
URL:
Keywords: regression
Depends on:
Blocks:
 
Reported: 2017-08-27 07:07 UTC by Eugene Grosbein
Modified: 2017-11-05 10:41 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Eugene Grosbein freebsd_committer freebsd_triage 2017-08-27 07:07:51 UTC
The revision https://svnweb.freebsd.org/base?view=revision&revision=313351 replaced ``if (h == NULL) return'' with KASSERT for ``h != NULL''.

Now "graid label" shell command that leads to ``root_mount_rel(mdi->mdio_rootmount)'' call with NULL argument making kernel panic due to ``LIST_REMOVE(h, list)'' in the root_mount_rel() code.

This needs to be fixed somehow.
Comment 1 Eugene Grosbein freebsd_committer freebsd_triage 2017-08-27 07:09:51 UTC
Please take a look and decide if root_mount_rel() should be fixed back to check its argument for NULL or its GEOM consumers should be fixed to not pass NULL there.
Comment 2 commit-hook freebsd_committer freebsd_triage 2017-09-05 14:33:35 UTC
A commit references this bug:

Author: trasz
Date: Tue Sep  5 14:32:56 UTC 2017
New revision: 323183
URL: https://svnweb.freebsd.org/changeset/base/323183

Log:
  Make root_mount_rel(9) ignore NULL arguments, like it used to before r313351.
  It would be better to fix API consumers to not pass NULL there - most of them,
  such as gmirror, already contain the neccessary checks - but this is easier
  and much less error-prone.

  One known user-visible result is that it fixes panic on a failed "graid label".

  PR:		221846
  MFC after:	2 weeks
  Sponsored by:	DARPA, AFRL

Changes:
  head/sys/kern/vfs_mountroot.c
Comment 3 Eugene Grosbein freebsd_committer freebsd_triage 2017-11-05 10:41:42 UTC
Committed with r323183 and MFC'd to stable/11 with r324268.