Commit 42ea37b
Paolo Abeni
Merge branch 'net-mana-fix-probe-remove-error-path-bugs'
Erni Sri Satya Vennela says:
====================
net: mana: Fix probe/remove error path bugs
Fix five bugs in mana_probe()/mana_remove() error handling that can
cause warnings on uninitialized work structs, NULL pointer dereferences,
masked errors, and resource leaks when early probe steps fail.
Patches 1-2 move work struct initialization (link_change_work and
gf_stats_work) to before any error path that could trigger
mana_remove(), preventing WARN_ON in __flush_work() or debug object
warnings when sync cancellation runs on uninitialized work structs.
Patch 3 guards mana_remove() against double invocation. If PM resume
fails, mana_probe() calls mana_remove() which sets gdma_context and
driver_data to NULL. A failed resume does not unbind the driver, so
when the device is eventually unbound, mana_remove() is called again
and dereferences NULL, causing a kernel panic. An early return on
NULL gdma_context or driver_data makes the second call harmless.
Patch 4 prevents add_adev() from overwriting a port probe error,
which could leave the driver in a broken state with NULL ports while
reporting success.
Patch 5 changes 'goto out' to 'break' in mana_remove()'s port loop
so that mana_destroy_eq() is always reached, preventing EQ leaks when
a NULL port is encountered.
====================
Link: https://patch.msgid.link/20260420124741.1056179-1-ernis@linux.microsoft.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>1 file changed
Lines changed: 20 additions & 15 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3631 | 3631 | | |
3632 | 3632 | | |
3633 | 3633 | | |
| 3634 | + | |
| 3635 | + | |
3634 | 3636 | | |
3635 | 3637 | | |
| 3638 | + | |
| 3639 | + | |
3636 | 3640 | | |
3637 | 3641 | | |
3638 | 3642 | | |
| |||
3648 | 3652 | | |
3649 | 3653 | | |
3650 | 3654 | | |
3651 | | - | |
3652 | | - | |
3653 | 3655 | | |
3654 | 3656 | | |
3655 | 3657 | | |
| |||
3678 | 3680 | | |
3679 | 3681 | | |
3680 | 3682 | | |
3681 | | - | |
3682 | | - | |
3683 | | - | |
3684 | | - | |
| 3683 | + | |
| 3684 | + | |
| 3685 | + | |
3685 | 3686 | | |
3686 | 3687 | | |
3687 | 3688 | | |
| |||
3695 | 3696 | | |
3696 | 3697 | | |
3697 | 3698 | | |
3698 | | - | |
3699 | | - | |
3700 | | - | |
3701 | | - | |
| 3699 | + | |
| 3700 | + | |
| 3701 | + | |
3702 | 3702 | | |
3703 | 3703 | | |
3704 | 3704 | | |
| |||
3707 | 3707 | | |
3708 | 3708 | | |
3709 | 3709 | | |
3710 | | - | |
| 3710 | + | |
| 3711 | + | |
3711 | 3712 | | |
3712 | | - | |
3713 | 3713 | | |
3714 | 3714 | | |
3715 | 3715 | | |
| |||
3730 | 3730 | | |
3731 | 3731 | | |
3732 | 3732 | | |
3733 | | - | |
| 3733 | + | |
3734 | 3734 | | |
3735 | 3735 | | |
3736 | 3736 | | |
3737 | 3737 | | |
| 3738 | + | |
| 3739 | + | |
| 3740 | + | |
| 3741 | + | |
| 3742 | + | |
3738 | 3743 | | |
3739 | 3744 | | |
3740 | 3745 | | |
| |||
3747 | 3752 | | |
3748 | 3753 | | |
3749 | 3754 | | |
3750 | | - | |
| 3755 | + | |
3751 | 3756 | | |
3752 | 3757 | | |
3753 | 3758 | | |
| |||
3778 | 3783 | | |
3779 | 3784 | | |
3780 | 3785 | | |
3781 | | - | |
| 3786 | + | |
3782 | 3787 | | |
3783 | 3788 | | |
3784 | 3789 | | |
| |||
0 commit comments