From 22c70d1a9c639b432ffdf083bea44752ad9fc8f3 Mon Sep 17 00:00:00 2001 From: Elena Reshetova Date: Thu, 9 Mar 2017 09:44:02 +0200 Subject: 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 Signed-off-by: Hans Liljestrand Signed-off-by: Kees Cook Signed-off-by: David Windsor Acked-by: Johannes Thumshirn Signed-off-by: Martin K. Petersen --- include/scsi/libfc.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'include/scsi/libfc.h') 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 #include #include +#include #include #include @@ -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; -- cgit v1.2.3-59-g8ed1b