Page MenuHomeFreeBSD

iicbus: Use device_delete_children() instead of explicit child removal
ClosedPublic

Authored by dumbbell on Oct 17 2015, 2:54 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sun, Feb 9, 8:29 AM
Unknown Object (File)
Wed, Jan 29, 10:53 PM
Unknown Object (File)
Wed, Jan 29, 10:47 PM
Unknown Object (File)
Jan 13 2025, 9:32 PM
Unknown Object (File)
Jan 9 2025, 2:17 AM
Unknown Object (File)
Dec 9 2024, 6:26 AM
Unknown Object (File)
Nov 28 2024, 5:24 PM
Unknown Object (File)
Nov 27 2024, 1:53 AM
Subscribers

Details

Summary

If the bus is detached and deleted by a call to device_delete_child() or device_delete_children() on a device higher in the tree, I²C children were already detached and deleted. So the device_t pointer stored in sc points to freed memory: we must not try to delete it again.

The same change is applied to my i915 WIP branch to the i915 driver. This fixes a general protection fault users reported.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

dumbbell retitled this revision from to iicbus: Use device_delete_children() instead of explicit child removal If the bus is detached and deleted by a call to device_delete_child() or device_delete_children() on a device higher in the tree, I²C children were already detached and....
dumbbell updated this object.
dumbbell edited the test plan for this revision. (Show Details)
dumbbell added reviewers: jhb, kib.
dumbbell retitled this revision from iicbus: Use device_delete_children() instead of explicit child removal If the bus is detached and deleted by a call to device_delete_child() or device_delete_children() on a device higher in the tree, I²C children were already detached and... to iicbus: Use device_delete_children() instead of explicit child removal.
jhb edited edge metadata.
This revision is now accepted and ready to land.Oct 19 2015, 9:29 PM
imp added a reviewer: imp.

I like it.

sys/dev/iicbus/iicbus.c
43 ↗(On Diff #9469)

Since the only changes to this file are white space, it might be better to do that as a separate commit.

sys/dev/iicbus/iicbus.c
43 ↗(On Diff #9469)

Agreed

sys/dev/iicbus/iicbus.c
43 ↗(On Diff #9469)

I planned to commit whitespace changes in a separate commit already, even for the other files.

This revision was automatically updated to reflect the committed changes.