summaryrefslogtreecommitdiff
path: root/include/scsi
diff options
context:
space:
mode:
authorElena Reshetova <elena.reshetova@intel.com>2017-03-09 10:44:02 +0300
committerMartin K. Petersen <martin.petersen@oracle.com>2017-03-16 01:44:02 +0300
commit22c70d1a9c639b432ffdf083bea44752ad9fc8f3 (patch)
tree77a5f3bf9d214c2e7abbcd09b309fa17627543a5 /include/scsi
parentfb5fe0fd626c425ed41842c4318aa7ab6f3c2db7 (diff)
downloadlinux-22c70d1a9c639b432ffdf083bea44752ad9fc8f3.tar.xz
scsi: libfc: convert fc_fcp_pkt.ref_cnt 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> Acked-by: Johannes Thumshirn <jth@kernel.org> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Diffstat (limited to 'include/scsi')
-rw-r--r--include/scsi/libfc.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/include/scsi/libfc.h b/include/scsi/libfc.h
index da5033dd8cbc..2109844be53d 100644
--- a/include/scsi/libfc.h
+++ b/include/scsi/libfc.h
@@ -23,6 +23,7 @@
#include <linux/timer.h>
#include <linux/if.h>
#include <linux/percpu.h>
+#include <linux/refcount.h>
#include <scsi/scsi_transport.h>
#include <scsi/scsi_transport_fc.h>
@@ -321,7 +322,7 @@ struct fc_seq_els_data {
*/
struct fc_fcp_pkt {
spinlock_t scsi_pkt_lock;
- atomic_t ref_cnt;
+ refcount_t ref_cnt;
/* SCSI command and data transfer information */
u32 data_len;