All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH V2 0/2] scsi: FDMI Fixes
@ 2021-06-03 10:14 Javed Hasan
  2021-06-03 10:14 ` [PATCH V2 1/2] scsi: fc: Corrected RHBA attributes length Javed Hasan
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Javed Hasan @ 2021-06-03 10:14 UTC (permalink / raw)
  To: martin.petersen; +Cc: linux-scsi, GR-QLogic-Storage-Upstream, jhasan, stable

This series has two fixes for FDMI.
Attributes length corrected for RHBA.
Fixed the wrong condition check in fc_ct_ms_fill_attr().

Kindly apply this series to scsi-queue at your earliest convenience.

Javed Hasan (2):
  scsi: fc: Corrected RHBA attributes length
  libfc: Corrected the condition check and invalid argument passed

 drivers/scsi/libfc/fc_encode.h | 8 +++++---
 include/scsi/fc/fc_ms.h        | 4 ++--
 2 files changed, 7 insertions(+), 5 deletions(-)

-- 
2.26.2


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

* [PATCH V2 1/2] scsi: fc: Corrected RHBA attributes length
  2021-06-03 10:14 [PATCH V2 0/2] scsi: FDMI Fixes Javed Hasan
@ 2021-06-03 10:14 ` Javed Hasan
  2021-06-03 10:14 ` [PATCH V2 2/2] libfc: Corrected the condition check and invalid argument passed Javed Hasan
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Javed Hasan @ 2021-06-03 10:14 UTC (permalink / raw)
  To: martin.petersen; +Cc: linux-scsi, GR-QLogic-Storage-Upstream, jhasan, stable

 -As per document of FC-GS-5, attribute lengths of node_name
  and manufacturer should in range of "4 to 64 Bytes" only.

Fixes: e721eb0616f6 ("scsi: scsi_transport_fc: Match HBA Attribute Length with HBAAPI V2.0 definitions")
Signed-off-by: Javed Hasan <jhasan@marvell.com>
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
CC: stable@vger.kernel.org
---
Changes in v2:
 - Added stable@vger.kernel.org in cc
---
 include/scsi/fc/fc_ms.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/scsi/fc/fc_ms.h b/include/scsi/fc/fc_ms.h
index 9e273fed0a85..800d53dc9470 100644
--- a/include/scsi/fc/fc_ms.h
+++ b/include/scsi/fc/fc_ms.h
@@ -63,8 +63,8 @@ enum fc_fdmi_hba_attr_type {
  * HBA Attribute Length
  */
 #define FC_FDMI_HBA_ATTR_NODENAME_LEN		8
-#define FC_FDMI_HBA_ATTR_MANUFACTURER_LEN	80
-#define FC_FDMI_HBA_ATTR_SERIALNUMBER_LEN	80
+#define FC_FDMI_HBA_ATTR_MANUFACTURER_LEN	64
+#define FC_FDMI_HBA_ATTR_SERIALNUMBER_LEN	64
 #define FC_FDMI_HBA_ATTR_MODEL_LEN		256
 #define FC_FDMI_HBA_ATTR_MODELDESCR_LEN		256
 #define FC_FDMI_HBA_ATTR_HARDWAREVERSION_LEN	256
-- 
2.26.2


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

* [PATCH V2 2/2] libfc: Corrected the condition check and invalid argument passed
  2021-06-03 10:14 [PATCH V2 0/2] scsi: FDMI Fixes Javed Hasan
  2021-06-03 10:14 ` [PATCH V2 1/2] scsi: fc: Corrected RHBA attributes length Javed Hasan
@ 2021-06-03 10:14 ` Javed Hasan
  2021-06-10  4:04 ` [PATCH V2 0/2] scsi: FDMI Fixes Martin K. Petersen
  2021-06-16  3:48 ` Martin K. Petersen
  3 siblings, 0 replies; 5+ messages in thread
From: Javed Hasan @ 2021-06-03 10:14 UTC (permalink / raw)
  To: martin.petersen; +Cc: linux-scsi, GR-QLogic-Storage-Upstream, jhasan, stable

 -In correct condition check was leading to data corruption
  and so the invalid argument.

Fixes: 8fd9efca86d0 ("scsi: libfc: Work around -Warray-bounds warning")
Signed-off-by: Javed Hasan <jhasan@marvell.com>
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
CC: stable@vger.kernel.org
---
Changes in v2:
 - Added stable@vger.kernel.org in cc
---
 drivers/scsi/libfc/fc_encode.h | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/scsi/libfc/fc_encode.h b/drivers/scsi/libfc/fc_encode.h
index 602c97a651bc..9ea4ceadb559 100644
--- a/drivers/scsi/libfc/fc_encode.h
+++ b/drivers/scsi/libfc/fc_encode.h
@@ -166,9 +166,11 @@ static inline int fc_ct_ns_fill(struct fc_lport *lport,
 static inline void fc_ct_ms_fill_attr(struct fc_fdmi_attr_entry *entry,
 				    const char *in, size_t len)
 {
-	int copied = strscpy(entry->value, in, len);
-	if (copied > 0)
-		memset(entry->value, copied, len - copied);
+	int copied;
+
+	copied = strscpy((char *)&entry->value, in, len);
+	if (copied > 0 && (copied + 1) < len)
+		memset((entry->value + copied + 1), 0, len - copied - 1);
 }
 
 /**
-- 
2.26.2


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

* Re: [PATCH V2 0/2] scsi: FDMI Fixes
  2021-06-03 10:14 [PATCH V2 0/2] scsi: FDMI Fixes Javed Hasan
  2021-06-03 10:14 ` [PATCH V2 1/2] scsi: fc: Corrected RHBA attributes length Javed Hasan
  2021-06-03 10:14 ` [PATCH V2 2/2] libfc: Corrected the condition check and invalid argument passed Javed Hasan
@ 2021-06-10  4:04 ` Martin K. Petersen
  2021-06-16  3:48 ` Martin K. Petersen
  3 siblings, 0 replies; 5+ messages in thread
From: Martin K. Petersen @ 2021-06-10  4:04 UTC (permalink / raw)
  To: Javed Hasan
  Cc: martin.petersen, linux-scsi, GR-QLogic-Storage-Upstream, stable


Javed,

> This series has two fixes for FDMI.
> Attributes length corrected for RHBA.
> Fixed the wrong condition check in fc_ct_ms_fill_attr().

Applied to 5.14/scsi-staging, thanks!

-- 
Martin K. Petersen	Oracle Linux Engineering

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

* Re: [PATCH V2 0/2] scsi: FDMI Fixes
  2021-06-03 10:14 [PATCH V2 0/2] scsi: FDMI Fixes Javed Hasan
                   ` (2 preceding siblings ...)
  2021-06-10  4:04 ` [PATCH V2 0/2] scsi: FDMI Fixes Martin K. Petersen
@ 2021-06-16  3:48 ` Martin K. Petersen
  3 siblings, 0 replies; 5+ messages in thread
From: Martin K. Petersen @ 2021-06-16  3:48 UTC (permalink / raw)
  To: Javed Hasan
  Cc: Martin K . Petersen, linux-scsi, GR-QLogic-Storage-Upstream, stable

On Thu, 3 Jun 2021 03:14:02 -0700, Javed Hasan wrote:

> This series has two fixes for FDMI.
> Attributes length corrected for RHBA.
> Fixed the wrong condition check in fc_ct_ms_fill_attr().
> 
> Kindly apply this series to scsi-queue at your earliest convenience.
> 
> Javed Hasan (2):
>   scsi: fc: Corrected RHBA attributes length
>   libfc: Corrected the condition check and invalid argument passed
> 
> [...]

Applied to 5.14/scsi-queue, thanks!

[1/2] scsi: fc: Corrected RHBA attributes length
      https://git.kernel.org/mkp/scsi/c/40445fd2c9fa
[2/2] libfc: Corrected the condition check and invalid argument passed
      https://git.kernel.org/mkp/scsi/c/8f70328c068f

-- 
Martin K. Petersen	Oracle Linux Engineering

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

end of thread, other threads:[~2021-06-16  3:49 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-03 10:14 [PATCH V2 0/2] scsi: FDMI Fixes Javed Hasan
2021-06-03 10:14 ` [PATCH V2 1/2] scsi: fc: Corrected RHBA attributes length Javed Hasan
2021-06-03 10:14 ` [PATCH V2 2/2] libfc: Corrected the condition check and invalid argument passed Javed Hasan
2021-06-10  4:04 ` [PATCH V2 0/2] scsi: FDMI Fixes Martin K. Petersen
2021-06-16  3:48 ` Martin K. Petersen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.