Commit 7fcb80c
sunvdc: Balance device refcount in vdc_port_mpgroup_check
Using device_find_child() to locate a probed virtual-device-port node
causes a device refcount imbalance, as device_find_child() internally
calls get_device() to increment the device’s reference count before
returning its pointer. vdc_port_mpgroup_check() directly returns true
upon finding a matching device without releasing the reference via
put_device(). We should call put_device() to decrement refcount.
As comment of device_find_child() says, 'NOTE: you will need to drop
the reference with put_device() after use'.
Found by code review.
Cc: [email protected]
Fixes: 3ee7059 ("sunvdc: prevent sunvdc panic when mpgroup disk added to guest domain")
Signed-off-by: Ma Ke <[email protected]>1 parent 87bbbbc commit 7fcb80c
1 file changed
Lines changed: 3 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
957 | 957 | | |
958 | 958 | | |
959 | 959 | | |
960 | | - | |
| 960 | + | |
| 961 | + | |
961 | 962 | | |
| 963 | + | |
962 | 964 | | |
963 | 965 | | |
964 | 966 | | |
| |||
0 commit comments