Elena Reshetova cdf5976fcb sparc64: convert mdesc_handle.refcnt from atomic_t to refcount_t
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 basic atomic operations
   (set, inc, inc_not_zero, dec_and_test, etc.)

Such atomic variables should be converted to a newly provided
refcount_t type and API that prevents accidental counter overflows
and underflows. This is important since overflows and underflows
can lead to use-after-free situation and be exploitable.

The variable mdesc_handle.refcnt is used as pure reference counter.
Convert it to refcount_t and fix up the operations.

Suggested-by: Kees Cook <keescook@chromium.org>
Reviewed-by: David Windsor <dwindsor@gmail.com>
Reviewed-by: Hans Liljestrand <ishkamiel@gmail.com>
Signed-off-by: Elena Reshetova <elena.reshetova@intel.com>
Acked-by: Shannon Nelson <shannon.nelson@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2017-11-15 14:28:23 +09:00
..
2014-05-18 19:01:30 -07:00
2014-05-18 19:01:29 -07:00
2017-06-01 09:42:46 -07:00
2016-08-07 23:55:43 -04:00
2017-03-28 18:24:00 -04:00
2016-08-07 23:55:43 -04:00
2016-07-27 22:53:17 -07:00
2017-06-06 16:41:47 -04:00
2017-06-12 15:44:03 -07:00
2017-11-15 14:21:03 +09:00
2017-03-27 21:51:40 -07:00
2014-12-14 16:10:09 -08:00
2017-09-08 15:47:43 -07:00
2015-03-19 18:54:49 -07:00
2017-06-25 22:01:11 -04:00
2013-06-13 22:12:14 +01:00
2012-03-28 18:30:03 +01:00
2017-03-27 21:51:40 -07:00
2014-07-21 22:27:56 -07:00
2017-04-23 18:28:55 -07:00
2017-04-23 18:28:55 -07:00
2017-06-15 08:25:19 -07:00
2017-11-15 14:21:03 +09:00
2017-08-15 21:48:07 -07:00
2017-06-06 13:45:29 -07:00
2017-03-27 21:51:40 -07:00
2017-11-15 14:21:03 +09:00
2017-03-27 21:51:40 -07:00