mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 02:32:09 -04:00
net: convert (struct ubuf_info)->refcnt to refcount_t
refcount_t type and corresponding API should be used instead of atomic_t when the variable is used as a reference counter. This allows to avoid accidental refcounter overflows that might lead to use-after-free situations. v2: added the change in drivers/vhost/net.c as spotted by Willem. Signed-off-by: Eric Dumazet <[email protected]> Acked-by: Willem de Bruijn <[email protected]> Signed-off-by: David S. Miller <[email protected]>
This commit is contained in:
parent
db5bce32fb
commit
c1d1b43781
3 changed files with 7 additions and 6 deletions
|
|
@ -533,7 +533,7 @@ static void handle_tx(struct vhost_net *net)
|
|||
ubuf->callback = vhost_zerocopy_callback;
|
||||
ubuf->ctx = nvq->ubufs;
|
||||
ubuf->desc = nvq->upend_idx;
|
||||
atomic_set(&ubuf->refcnt, 1);
|
||||
refcount_set(&ubuf->refcnt, 1);
|
||||
msg.msg_control = ubuf;
|
||||
msg.msg_controllen = sizeof(ubuf);
|
||||
ubufs = nvq->ubufs;
|
||||
|
|
|
|||
Loading…
Reference in a new issue