Skip to content

Commit

Permalink
locking/refcount: Remove the half-implemented refcount_sub() API
Browse files Browse the repository at this point in the history
CONFIG_REFCOUNT_FULL=y (correctly) does not provide a refcount_sub(),
which should not be part of proper refcount design patterns.

Remove the erroneous extern and the later !CONFIG_REFCOUNT_FULL
accidental implementation.

Signed-off-by: Kees Cook <keescook@chromium.org>
Cc: Elena Reshetova <elena.reshetova@intel.com>
Cc: Josh Poimboeuf <jpoimboe@redhat.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Fixes: 29dee3c ("locking/refcounts: Out-of-line everything")
Link: http://lkml.kernel.org/r/20170701180129.GA17405@beast
Signed-off-by: Ingo Molnar <mingo@kernel.org>
  • Loading branch information
Kees Cook authored and Ingo Molnar committed Jul 2, 2017
1 parent fd25d19 commit 5d6dec6
Showing 1 changed file with 0 additions and 6 deletions.
6 changes: 0 additions & 6 deletions include/linux/refcount.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ extern __must_check bool refcount_inc_not_zero(refcount_t *r);
extern void refcount_inc(refcount_t *r);

extern __must_check bool refcount_sub_and_test(unsigned int i, refcount_t *r);
extern void refcount_sub(unsigned int i, refcount_t *r);

extern __must_check bool refcount_dec_and_test(refcount_t *r);
extern void refcount_dec(refcount_t *r);
Expand Down Expand Up @@ -79,11 +78,6 @@ static inline __must_check bool refcount_sub_and_test(unsigned int i, refcount_t
return atomic_sub_and_test(i, &r->refs);
}

static inline void refcount_sub(unsigned int i, refcount_t *r)
{
atomic_sub(i, &r->refs);
}

static inline __must_check bool refcount_dec_and_test(refcount_t *r)
{
return atomic_dec_and_test(&r->refs);
Expand Down

0 comments on commit 5d6dec6

Please sign in to comment.