search for: refcount_inc

Displaying 20 results from an estimated 41 matches for "refcount_inc".

2017 Dec 08
3
[PATCH] drm/nouveau/imem/nv50: fix incorrect use of refcount API
Commit be55287aa5b ("drm/nouveau/imem/nv50: embed nvkm_instobj directly into nv04_instobj") introduced some new calls to the refcount api to the nv50 mapping code. In one particular instance, it does the following: if (!refcount_inc_not_zero(&iobj->maps)) { ... refcount_inc(&iobj->maps); } i.e., it calls refcount_inc() to increment the refcount when it is known to be zero, which is explicitly forbidden by the API. Instead, use refcount_set() to set it to 1. Signed-off-by: Ard Biesheu...
2017 Dec 18
1
[PATCH] drm/nouveau/imem/nv50: fix incorrect use of refcount API
...rote: > > Commit be55287aa5b ("drm/nouveau/imem/nv50: embed nvkm_instobj directly > > into nv04_instobj") introduced some new calls to the refcount api to > > the nv50 mapping code. In one particular instance, it does the > > following: > > > > if (!refcount_inc_not_zero(&iobj->maps)) { > > ... > > refcount_inc(&iobj->maps); > > } > > > > i.e., it calls refcount_inc() to increment the refcount when it is known > > to be zero, which is explicitly forbidden by the API. Instead, use...
2017 Dec 18
0
[PATCH] drm/nouveau/imem/nv50: fix incorrect use of refcount API
...biesheuvel at linaro.org> wrote: > Commit be55287aa5b ("drm/nouveau/imem/nv50: embed nvkm_instobj directly > into nv04_instobj") introduced some new calls to the refcount api to > the nv50 mapping code. In one particular instance, it does the > following: > > if (!refcount_inc_not_zero(&iobj->maps)) { > ... > refcount_inc(&iobj->maps); > } > > i.e., it calls refcount_inc() to increment the refcount when it is known > to be zero, which is explicitly forbidden by the API. Instead, use > refcount_set() to set it...
2017 Dec 03
0
nouveau: refcount_t splat on 4.15-rc1 on nv50
...ut10 [ 8.208559] nouveau 0000:0f:00.0: bios: version 70.18.a6.00.00 [ 8.209028] nouveau 0000:0f:00.0: fb: 1024 MiB DDR3 [ 8.209046] ------------[ cut here ]------------ [ 8.209048] refcount_t: increment on 0; use-after-free. [ 8.209068] WARNING: CPU: 2 PID: 529 at lib/refcount.c:153 refcount_inc+0x27/0x30 [ 8.209070] Modules linked in: wmi_bmof coretemp snd_hda_codec_realtek nouveau(+) intel_powerclamp snd_hda_codec_generic mxm_wmi kvm_intel video snd_hda_intel ttm kvm snd_hda_codec tg3 irqbypass drm_kms_helper snd_hda_core psmouse drm crc32c_intel snd_hwdep libphy evdev agpgart snd...
2017 Dec 02
0
nouveau: refcount_t splat on 4.15-rc1 on nv50
..... [ 9.585172] nouveau 0000:01:00.0: bios: version 70.24.2e.00.02 ... [ 9.772204] nouveau 0000:01:00.0: fb: 1024 MiB GDDR5 [ 9.777342] ------------[ cut here ]------------ [ 9.782106] refcount_t: increment on 0; use-after-free. [ 9.787522] WARNING: CPU: 0 PID: 3 at lib/refcount.c:153 refcount_inc+0x30/0x50 [ 9.795060] Modules linked in: sha256_generic cfg80211(+) rfkill snd_usb_audio snd_usbmidi_lib nouveau(+) video ttm [ 9.805756] CPU: 0 PID: 3 Comm: kworker/0:0 Not tainted 4.15.0-rc1-debug-ubsan-00020-gf4707a916107 #1 [ 9.815215] Hardware name: System manufacturer System Product...
2020 Apr 30
3
[PATCH v4] virtio-blk: handle block_device_operations callbacks after hot unplug
...once no + * longer in use. + */ + refcount_t refs; + /* What host tells us, plus 2 for header & tailer. */ unsigned int sg_elems; @@ -295,10 +311,55 @@ static int virtblk_get_id(struct gendisk *disk, char *id_str) return err; } +static void virtblk_get(struct virtio_blk *vblk) +{ + refcount_inc(&vblk->refs); +} + +static void virtblk_put(struct virtio_blk *vblk) +{ + if (refcount_dec_and_test(&vblk->refs)) { + ida_simple_remove(&vd_index_ida, vblk->index); + mutex_destroy(&vblk->vdev_mutex); + kfree(vblk); + } +} + +static int virtblk_open(struct block_devic...
2020 Apr 30
3
[PATCH v4] virtio-blk: handle block_device_operations callbacks after hot unplug
...once no + * longer in use. + */ + refcount_t refs; + /* What host tells us, plus 2 for header & tailer. */ unsigned int sg_elems; @@ -295,10 +311,55 @@ static int virtblk_get_id(struct gendisk *disk, char *id_str) return err; } +static void virtblk_get(struct virtio_blk *vblk) +{ + refcount_inc(&vblk->refs); +} + +static void virtblk_put(struct virtio_blk *vblk) +{ + if (refcount_dec_and_test(&vblk->refs)) { + ida_simple_remove(&vd_index_ida, vblk->index); + mutex_destroy(&vblk->vdev_mutex); + kfree(vblk); + } +} + +static int virtblk_open(struct block_devic...
2020 Apr 28
2
[PATCH v2] virtio-blk: handle block_device_operations callbacks after hot unplug
...truct virtio_blk_vq *vqs; + + /* Provides mutual exclusion with virtblk_remove(). */ + struct mutex remove_mutex; }; struct virtblk_req { @@ -295,10 +305,54 @@ static int virtblk_get_id(struct gendisk *disk, char *id_str) return err; } +static void virtblk_get(struct virtio_blk *vblk) +{ + refcount_inc(&vblk->refs); +} + +static void virtblk_put(struct virtio_blk *vblk) +{ + if (refcount_dec_and_test(&vblk->refs)) { + ida_simple_remove(&vd_index_ida, vblk->index); + mutex_destroy(&vblk->remove_mutex); + kfree(vblk); + } +} + +static int virtblk_open(struct block_dev...
2020 Apr 28
2
[PATCH v2] virtio-blk: handle block_device_operations callbacks after hot unplug
...truct virtio_blk_vq *vqs; + + /* Provides mutual exclusion with virtblk_remove(). */ + struct mutex remove_mutex; }; struct virtblk_req { @@ -295,10 +305,54 @@ static int virtblk_get_id(struct gendisk *disk, char *id_str) return err; } +static void virtblk_get(struct virtio_blk *vblk) +{ + refcount_inc(&vblk->refs); +} + +static void virtblk_put(struct virtio_blk *vblk) +{ + if (refcount_dec_and_test(&vblk->refs)) { + ida_simple_remove(&vd_index_ida, vblk->index); + mutex_destroy(&vblk->remove_mutex); + kfree(vblk); + } +} + +static int virtblk_open(struct block_dev...
2018 Dec 17
3
[PATCH v3 00/12] x86, kbuild: revert macrofying inline assembly code
...fconfig: nr_symbols [1] v4.20-rc7 : 96502 [2] [1]+full revert : 96705 (+203) [3] [2]+"asm inline": 96568 (-137) [3]: apply my patch, then replace "asm" -> "asm_inline" for _BUG_FLAGS(), refcount_add(), refcount_inc(), refcount_dec(), annotate_reachable(), annotate_unreachable() Changes in v3: - Split into per-commit revert (per Nadav Amit) - Add some cleanups with preprocessor approach Changes in v2: - Revive clean-ups made by 5bdcd510c2ac (per Peter Zijlstra) - Fix commit quoting style (pe...
2018 Dec 17
3
[PATCH v3 00/12] x86, kbuild: revert macrofying inline assembly code
...fconfig: nr_symbols [1] v4.20-rc7 : 96502 [2] [1]+full revert : 96705 (+203) [3] [2]+"asm inline": 96568 (-137) [3]: apply my patch, then replace "asm" -> "asm_inline" for _BUG_FLAGS(), refcount_add(), refcount_inc(), refcount_dec(), annotate_reachable(), annotate_unreachable() Changes in v3: - Split into per-commit revert (per Nadav Amit) - Add some cleanups with preprocessor approach Changes in v2: - Revive clean-ups made by 5bdcd510c2ac (per Peter Zijlstra) - Fix commit quoting style (pe...
2020 Apr 28
1
[PATCH v2] virtio-blk: handle block_device_operations callbacks after hot unplug
...remove_mutex; > > }; > > > > struct virtblk_req { > > @@ -295,10 +305,54 @@ static int virtblk_get_id(struct gendisk *disk, char *id_str) > > return err; > > } > > > > +static void virtblk_get(struct virtio_blk *vblk) > > +{ > > + refcount_inc(&vblk->refs); > > +} > > + > > +static void virtblk_put(struct virtio_blk *vblk) > > +{ > > + if (refcount_dec_and_test(&vblk->refs)) { > > + ida_simple_remove(&vd_index_ida, vblk->index); > > + mutex_destroy(&vblk->remove_mute...
2020 May 04
0
[PATCH v4] virtio-blk: handle block_device_operations callbacks after hot unplug
...t; + > /* What host tells us, plus 2 for header & tailer. */ > unsigned int sg_elems; > > @@ -295,10 +311,55 @@ static int virtblk_get_id(struct gendisk *disk, char *id_str) > return err; > } > > +static void virtblk_get(struct virtio_blk *vblk) > +{ > + refcount_inc(&vblk->refs); Should the code even be able to grab a ref if !vblk->vdev? > +} > + > +static void virtblk_put(struct virtio_blk *vblk) > +{ > + if (refcount_dec_and_test(&vblk->refs)) { > + ida_simple_remove(&vd_index_ida, vblk->index); > + mutex_dest...
2020 Apr 29
2
[PATCH v3] virtio-blk: handle block_device_operations callbacks after hot unplug
...once no + * longer in use. + */ + refcount_t refs; + /* What host tells us, plus 2 for header & tailer. */ unsigned int sg_elems; @@ -295,10 +312,55 @@ static int virtblk_get_id(struct gendisk *disk, char *id_str) return err; } +static void virtblk_get(struct virtio_blk *vblk) +{ + refcount_inc(&vblk->refs); +} + +static void virtblk_put(struct virtio_blk *vblk) +{ + if (refcount_dec_and_test(&vblk->refs)) { + ida_simple_remove(&vd_index_ida, vblk->index); + mutex_destroy(&vblk->vdev_mutex); + kfree(vblk); + } +} + +static int virtblk_open(struct block_devic...
2020 Apr 29
2
[PATCH v3] virtio-blk: handle block_device_operations callbacks after hot unplug
...once no + * longer in use. + */ + refcount_t refs; + /* What host tells us, plus 2 for header & tailer. */ unsigned int sg_elems; @@ -295,10 +312,55 @@ static int virtblk_get_id(struct gendisk *disk, char *id_str) return err; } +static void virtblk_get(struct virtio_blk *vblk) +{ + refcount_inc(&vblk->refs); +} + +static void virtblk_put(struct virtio_blk *vblk) +{ + if (refcount_dec_and_test(&vblk->refs)) { + ida_simple_remove(&vd_index_ida, vblk->index); + mutex_destroy(&vblk->vdev_mutex); + kfree(vblk); + } +} + +static int virtblk_open(struct block_devic...
2023 Apr 10
1
[PATCH v6 11/11] vhost: allow userspace to create workers
...down there. > > > >> > >> +/* Caller must have device and virtqueue mutex */ > >> +static void __vhost_vq_attach_worker(struct vhost_virtqueue *vq, > >> + struct vhost_worker *worker) > >> +{ > >> + refcount_inc(&worker->refcount); > >> + vhost_vq_detach_worker(vq);()) > >> + vq->worker = worker; > > > > What happens if there's a pending flush in a specific device (e.g in > > vhost_scsi_tmf_resp_work())? > > We wouldn't hit that specif...
2020 Apr 28
0
[PATCH v2] virtio-blk: handle block_device_operations callbacks after hot unplug
...ght? Pls add to the comment. > + struct mutex remove_mutex; > }; > > struct virtblk_req { > @@ -295,10 +305,54 @@ static int virtblk_get_id(struct gendisk *disk, char *id_str) > return err; > } > > +static void virtblk_get(struct virtio_blk *vblk) > +{ > + refcount_inc(&vblk->refs); > +} > + > +static void virtblk_put(struct virtio_blk *vblk) > +{ > + if (refcount_dec_and_test(&vblk->refs)) { > + ida_simple_remove(&vd_index_ida, vblk->index); > + mutex_destroy(&vblk->remove_mutex); > + kfree(vblk); > + } &...
2020 Apr 30
0
[PATCH v3] virtio-blk: handle block_device_operations callbacks after hot unplug
...t; + > /* What host tells us, plus 2 for header & tailer. */ > unsigned int sg_elems; > > @@ -295,10 +312,55 @@ static int virtblk_get_id(struct gendisk *disk, char *id_str) > return err; > } > > +static void virtblk_get(struct virtio_blk *vblk) > +{ > + refcount_inc(&vblk->refs); > +} > + > +static void virtblk_put(struct virtio_blk *vblk) > +{ > + if (refcount_dec_and_test(&vblk->refs)) { > + ida_simple_remove(&vd_index_ida, vblk->index); > + mutex_destroy(&vblk->vdev_mutex); > + kfree(vblk); > + } &gt...
2020 May 14
0
[PATCH AUTOSEL 5.6 32/62] virtio-blk: handle block_device_operations callbacks after hot unplug
...once no + * longer in use. + */ + refcount_t refs; + /* What host tells us, plus 2 for header & tailer. */ unsigned int sg_elems; @@ -294,10 +310,55 @@ static int virtblk_get_id(struct gendisk *disk, char *id_str) return err; } +static void virtblk_get(struct virtio_blk *vblk) +{ + refcount_inc(&vblk->refs); +} + +static void virtblk_put(struct virtio_blk *vblk) +{ + if (refcount_dec_and_test(&vblk->refs)) { + ida_simple_remove(&vd_index_ida, vblk->index); + mutex_destroy(&vblk->vdev_mutex); + kfree(vblk); + } +} + +static int virtblk_open(struct block_devic...
2020 May 14
0
[PATCH AUTOSEL 4.19 22/31] virtio-blk: handle block_device_operations callbacks after hot unplug
...once no + * longer in use. + */ + refcount_t refs; + /* What host tells us, plus 2 for header & tailer. */ unsigned int sg_elems; @@ -320,10 +336,55 @@ static int virtblk_get_id(struct gendisk *disk, char *id_str) return err; } +static void virtblk_get(struct virtio_blk *vblk) +{ + refcount_inc(&vblk->refs); +} + +static void virtblk_put(struct virtio_blk *vblk) +{ + if (refcount_dec_and_test(&vblk->refs)) { + ida_simple_remove(&vd_index_ida, vblk->index); + mutex_destroy(&vblk->vdev_mutex); + kfree(vblk); + } +} + +static int virtblk_open(struct block_devic...