linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] scsi: qla2xxx: Fix serialization of DCBX TLV data request
@ 2022-09-26 23:02 Rafael Mendonca
  2022-09-27 18:26 ` Himanshu Madhani
  2022-10-01  9:50 ` Martin K. Petersen
  0 siblings, 2 replies; 3+ messages in thread
From: Rafael Mendonca @ 2022-09-26 23:02 UTC (permalink / raw)
  To: Nilesh Javali, GR-QLogic-Storage-Upstream, James E.J. Bottomley,
	Martin K. Petersen, Himanshu Madhani, Quinn Tran
  Cc: Rafael Mendonca, linux-scsi, linux-kernel

Commit b6faaaf796d7 ("scsi: qla2xxx: Serialize mailbox request") serialized
mailbox requests from userspace using the 'optrom' mutex. However, in the
case of DCBX TLV data, if the memory for it is already allocated, then the
mailbox request ends up not being serialized because it is done without
holding the 'optrom' mutex.

Fixes: b6faaaf796d7 ("scsi: qla2xxx: Serialize mailbox request")
Signed-off-by: Rafael Mendonca <rafaelmendsr@gmail.com>
---
 drivers/scsi/qla2xxx/qla_attr.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/qla2xxx/qla_attr.c b/drivers/scsi/qla2xxx/qla_attr.c
index fa1fcbfb946f..c2bc7f9c728a 100644
--- a/drivers/scsi/qla2xxx/qla_attr.c
+++ b/drivers/scsi/qla2xxx/qla_attr.c
@@ -951,9 +951,9 @@ qla2x00_sysfs_read_dcbx_tlv(struct file *filp, struct kobject *kobj,
 	if (!capable(CAP_SYS_ADMIN) || off != 0 || count > DCBX_TLV_DATA_SIZE)
 		return 0;
 
+	mutex_lock(&vha->hw->optrom_mutex);
 	if (ha->dcbx_tlv)
 		goto do_read;
-	mutex_lock(&vha->hw->optrom_mutex);
 	if (qla2x00_chip_is_down(vha)) {
 		mutex_unlock(&vha->hw->optrom_mutex);
 		return 0;
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] scsi: qla2xxx: Fix serialization of DCBX TLV data request
  2022-09-26 23:02 [PATCH] scsi: qla2xxx: Fix serialization of DCBX TLV data request Rafael Mendonca
@ 2022-09-27 18:26 ` Himanshu Madhani
  2022-10-01  9:50 ` Martin K. Petersen
  1 sibling, 0 replies; 3+ messages in thread
From: Himanshu Madhani @ 2022-09-27 18:26 UTC (permalink / raw)
  To: Rafael Mendonca
  Cc: Nilesh Javali, GR-QLogic-Storage-Upstream, James E.J. Bottomley,
	Martin Petersen, Himanshu Madhani, Quinn Tran, linux-scsi,
	linux-kernel



> On Sep 26, 2022, at 4:02 PM, Rafael Mendonca <rafaelmendsr@gmail.com> wrote:
> 
> Commit b6faaaf796d7 ("scsi: qla2xxx: Serialize mailbox request") serialized
> mailbox requests from userspace using the 'optrom' mutex. However, in the
> case of DCBX TLV data, if the memory for it is already allocated, then the
> mailbox request ends up not being serialized because it is done without
> holding the 'optrom' mutex.
> 
> Fixes: b6faaaf796d7 ("scsi: qla2xxx: Serialize mailbox request")
> Signed-off-by: Rafael Mendonca <rafaelmendsr@gmail.com>
> ---
> drivers/scsi/qla2xxx/qla_attr.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/scsi/qla2xxx/qla_attr.c b/drivers/scsi/qla2xxx/qla_attr.c
> index fa1fcbfb946f..c2bc7f9c728a 100644
> --- a/drivers/scsi/qla2xxx/qla_attr.c
> +++ b/drivers/scsi/qla2xxx/qla_attr.c
> @@ -951,9 +951,9 @@ qla2x00_sysfs_read_dcbx_tlv(struct file *filp, struct kobject *kobj,
> 	if (!capable(CAP_SYS_ADMIN) || off != 0 || count > DCBX_TLV_DATA_SIZE)
> 		return 0;
> 
> +	mutex_lock(&vha->hw->optrom_mutex);
> 	if (ha->dcbx_tlv)
> 		goto do_read;
> -	mutex_lock(&vha->hw->optrom_mutex);
> 	if (qla2x00_chip_is_down(vha)) {
> 		mutex_unlock(&vha->hw->optrom_mutex);
> 		return 0;
> -- 
> 2.34.1
> 

Looks Good. 

Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>

-- 
Himanshu Madhani	Oracle Linux Engineering


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] scsi: qla2xxx: Fix serialization of DCBX TLV data request
  2022-09-26 23:02 [PATCH] scsi: qla2xxx: Fix serialization of DCBX TLV data request Rafael Mendonca
  2022-09-27 18:26 ` Himanshu Madhani
@ 2022-10-01  9:50 ` Martin K. Petersen
  1 sibling, 0 replies; 3+ messages in thread
From: Martin K. Petersen @ 2022-10-01  9:50 UTC (permalink / raw)
  To: Rafael Mendonca
  Cc: Nilesh Javali, GR-QLogic-Storage-Upstream, James E.J. Bottomley,
	Martin K. Petersen, Himanshu Madhani, Quinn Tran, linux-scsi,
	linux-kernel


Rafael,

> Commit b6faaaf796d7 ("scsi: qla2xxx: Serialize mailbox request")
> serialized mailbox requests from userspace using the 'optrom'
> mutex. However, in the case of DCBX TLV data, if the memory for it is
> already allocated, then the mailbox request ends up not being
> serialized because it is done without holding the 'optrom' mutex.

Applied to 6.1/scsi-staging, thanks!

-- 
Martin K. Petersen	Oracle Linux Engineering

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-10-01  9:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-26 23:02 [PATCH] scsi: qla2xxx: Fix serialization of DCBX TLV data request Rafael Mendonca
2022-09-27 18:26 ` Himanshu Madhani
2022-10-01  9:50 ` Martin K. Petersen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).