diff options
| author | Eric Dumazet <[email protected]> | 2021-03-22 18:21:45 +0000 |
|---|---|---|
| committer | David S. Miller <[email protected]> | 2021-03-22 23:57:36 +0000 |
| commit | add2d73631070c951b0de81a01d1463a15cfbd47 (patch) | |
| tree | 17f432ad418341482f02ec52ef9daacc01e0ee77 /net/lapb/lapb_iface.c | |
| parent | Merge branch 'dpaa2-switch-offload-port-flags' (diff) | |
| download | kernel-add2d73631070c951b0de81a01d1463a15cfbd47.tar.gz kernel-add2d73631070c951b0de81a01d1463a15cfbd47.zip | |
net: set initial device refcount to 1
When adding CONFIG_PCPU_DEV_REFCNT, I forgot that the
initial net device refcount was 0.
When CONFIG_PCPU_DEV_REFCNT is not set, this means
the first dev_hold() triggers an illegal refcount
operation (addition on 0)
refcount_t: addition on 0; use-after-free.
WARNING: CPU: 0 PID: 1 at lib/refcount.c:25 refcount_warn_saturate+0x128/0x1a4
Fix is to change initial (and final) refcount to be 1.
Also add a missing kerneldoc piece, as reported by
Stephen Rothwell.
Fixes: 919067cc845f ("net: add CONFIG_PCPU_DEV_REFCNT")
Signed-off-by: Eric Dumazet <[email protected]>
Reported-by: Guenter Roeck <[email protected]>
Tested-by: Guenter Roeck <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
Diffstat (limited to 'net/lapb/lapb_iface.c')
0 files changed, 0 insertions, 0 deletions
