diff options
author | Elena Reshetova <elena.reshetova@intel.com> | 2017-03-06 15:21:12 +0100 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2017-03-17 05:32:59 +0100 |
commit | 43938613c6fd2e58a0be212c832e1878bedefe5a (patch) | |
tree | b8d7a05d962948575b931c54d98072f0b3e33f8f /drivers/usb/gadget/function/u_fs.h | |
parent | USB: misc: sisusb_con: fix coccinelle warning (diff) | |
download | linux-43938613c6fd2e58a0be212c832e1878bedefe5a.tar.xz linux-43938613c6fd2e58a0be212c832e1878bedefe5a.zip |
drivers, usb: convert ffs_data.ref from atomic_t 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.
Signed-off-by: Elena Reshetova <elena.reshetova@intel.com>
Signed-off-by: Hans Liljestrand <ishkamiel@gmail.com>
Signed-off-by: Kees Cook <keescook@chromium.org>
Signed-off-by: David Windsor <dwindsor@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb/gadget/function/u_fs.h')
-rw-r--r-- | drivers/usb/gadget/function/u_fs.h | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/usb/gadget/function/u_fs.h b/drivers/usb/gadget/function/u_fs.h index 4b6969451cdc..abfca4854433 100644 --- a/drivers/usb/gadget/function/u_fs.h +++ b/drivers/usb/gadget/function/u_fs.h @@ -20,6 +20,7 @@ #include <linux/list.h> #include <linux/mutex.h> #include <linux/workqueue.h> +#include <linux/refcount.h> #ifdef VERBOSE_DEBUG #ifndef pr_vdebug @@ -177,7 +178,7 @@ struct ffs_data { struct completion ep0req_completion; /* P: mutex */ /* reference counter */ - atomic_t ref; + refcount_t ref; /* how many files are opened (EP0 and others) */ atomic_t opened; |