[PATCH 3/5] fs, xfs: convert xlog_ticket.t_ref from atomic_t to refcount_t

2017-11-29 Thread Elena Reshetova
atomic_t variables are currently used to implement reference counters with the following properties: - counter is initialized to 1 using atomic_set() - a resource is freed upon counter reaching zero - once counter reaches zero, its further increments aren't allowed - counter schema uses

[PATCH 3/5] fs, xfs: convert xlog_ticket.t_ref from atomic_t to refcount_t

2017-11-29 Thread Elena Reshetova
atomic_t variables are currently used to implement reference counters with the following properties: - counter is initialized to 1 using atomic_set() - a resource is freed upon counter reaching zero - once counter reaches zero, its further increments aren't allowed - counter schema uses

[PATCH 3/5] fs, xfs: convert xlog_ticket.t_ref from atomic_t to refcount_t

2017-10-20 Thread Elena Reshetova
atomic_t variables are currently used to implement reference counters with the following properties: - counter is initialized to 1 using atomic_set() - a resource is freed upon counter reaching zero - once counter reaches zero, its further increments aren't allowed - counter schema uses

[PATCH 3/5] fs, xfs: convert xlog_ticket.t_ref from atomic_t to refcount_t

2017-10-20 Thread Elena Reshetova
atomic_t variables are currently used to implement reference counters with the following properties: - counter is initialized to 1 using atomic_set() - a resource is freed upon counter reaching zero - once counter reaches zero, its further increments aren't allowed - counter schema uses

RE: [PATCH 3/5] fs, xfs: convert xlog_ticket.t_ref from atomic_t to refcount_t

2017-03-08 Thread Reshetova, Elena
> On Wed, Mar 8, 2017 at 7:50 AM, Christoph Hellwig wrote: > >> - ASSERT(atomic_read(>t_ref) > 0); > >> - atomic_inc(>t_ref); > >> + ASSERT(refcount_read(>t_ref) > 0); > >> + refcount_inc(>t_ref); > > > > With strict refcount semantics refcount_inc should

RE: [PATCH 3/5] fs, xfs: convert xlog_ticket.t_ref from atomic_t to refcount_t

2017-03-08 Thread Reshetova, Elena
> On Wed, Mar 8, 2017 at 7:50 AM, Christoph Hellwig wrote: > >> - ASSERT(atomic_read(>t_ref) > 0); > >> - atomic_inc(>t_ref); > >> + ASSERT(refcount_read(>t_ref) > 0); > >> + refcount_inc(>t_ref); > > > > With strict refcount semantics refcount_inc should check that > > the count

Re: [PATCH 3/5] fs, xfs: convert xlog_ticket.t_ref from atomic_t to refcount_t

2017-03-08 Thread Kees Cook
On Wed, Mar 8, 2017 at 7:50 AM, Christoph Hellwig wrote: >> - ASSERT(atomic_read(>t_ref) > 0); >> - atomic_inc(>t_ref); >> + ASSERT(refcount_read(>t_ref) > 0); >> + refcount_inc(>t_ref); > > With strict refcount semantics refcount_inc should check that > the

Re: [PATCH 3/5] fs, xfs: convert xlog_ticket.t_ref from atomic_t to refcount_t

2017-03-08 Thread Kees Cook
On Wed, Mar 8, 2017 at 7:50 AM, Christoph Hellwig wrote: >> - ASSERT(atomic_read(>t_ref) > 0); >> - atomic_inc(>t_ref); >> + ASSERT(refcount_read(>t_ref) > 0); >> + refcount_inc(>t_ref); > > With strict refcount semantics refcount_inc should check that > the count is larger than

Re: [PATCH 3/5] fs, xfs: convert xlog_ticket.t_ref from atomic_t to refcount_t

2017-03-08 Thread Christoph Hellwig
> - ASSERT(atomic_read(>t_ref) > 0); > - atomic_inc(>t_ref); > + ASSERT(refcount_read(>t_ref) > 0); > + refcount_inc(>t_ref); With strict refcount semantics refcount_inc should check that the count is larger than 0, otherwise we'd need to use recount_inc_not_zero or whatever

Re: [PATCH 3/5] fs, xfs: convert xlog_ticket.t_ref from atomic_t to refcount_t

2017-03-08 Thread Christoph Hellwig
> - ASSERT(atomic_read(>t_ref) > 0); > - atomic_inc(>t_ref); > + ASSERT(refcount_read(>t_ref) > 0); > + refcount_inc(>t_ref); With strict refcount semantics refcount_inc should check that the count is larger than 0, otherwise we'd need to use recount_inc_not_zero or whatever

[PATCH 3/5] fs, xfs: convert xlog_ticket.t_ref from atomic_t to refcount_t

2017-03-08 Thread Elena Reshetova
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. Signed-off-by: Elena Reshetova Signed-off-by:

[PATCH 3/5] fs, xfs: convert xlog_ticket.t_ref from atomic_t to refcount_t

2017-03-08 Thread Elena Reshetova
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. Signed-off-by: Elena Reshetova Signed-off-by: Hans Liljestrand

[PATCH 3/5] fs, xfs: convert xlog_ticket.t_ref from atomic_t to refcount_t

2017-03-01 Thread Elena Reshetova
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. Signed-off-by: Elena Reshetova Signed-off-by:

[PATCH 3/5] fs, xfs: convert xlog_ticket.t_ref from atomic_t to refcount_t

2017-03-01 Thread Elena Reshetova
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. Signed-off-by: Elena Reshetova Signed-off-by: Hans Liljestrand