netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net] bna: fill the magic in bnad_get_eeprom() instead of validating
@ 2014-07-28 13:03 Ivan Vecera
  2014-07-30 20:57 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Ivan Vecera @ 2014-07-28 13:03 UTC (permalink / raw)
  To: netdev; +Cc: rmody

A driver should fill magic field of ethtool_eeprom struct in .get_eeprom
and validate it in .set_eeprom. The bna incorrectly validates it in both
and this makes its .get_eeprom interface unusable.

Signed-off-by: Ivan Vecera <ivecera@redhat.com>
---
 drivers/net/ethernet/brocade/bna/bnad_ethtool.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/brocade/bna/bnad_ethtool.c b/drivers/net/ethernet/brocade/bna/bnad_ethtool.c
index 882cad7..d26adac 100644
--- a/drivers/net/ethernet/brocade/bna/bnad_ethtool.c
+++ b/drivers/net/ethernet/brocade/bna/bnad_ethtool.c
@@ -997,10 +997,8 @@ bnad_get_eeprom(struct net_device *netdev, struct ethtool_eeprom *eeprom,
 	unsigned long flags = 0;
 	int ret = 0;
 
-	/* Check if the flash read request is valid */
-	if (eeprom->magic != (bnad->pcidev->vendor |
-			     (bnad->pcidev->device << 16)))
-		return -EFAULT;
+	/* Fill the magic value */
+	eeprom->magic = bnad->pcidev->vendor | (bnad->pcidev->device << 16);
 
 	/* Query the flash partition based on the offset */
 	flash_part = bnad_get_flash_partition_by_offset(bnad,
-- 
1.8.5.5

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

* Re: [PATCH net] bna: fill the magic in bnad_get_eeprom() instead of validating
  2014-07-28 13:03 [PATCH net] bna: fill the magic in bnad_get_eeprom() instead of validating Ivan Vecera
@ 2014-07-30 20:57 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2014-07-30 20:57 UTC (permalink / raw)
  To: ivecera; +Cc: netdev, rmody

From: Ivan Vecera <ivecera@redhat.com>
Date: Mon, 28 Jul 2014 15:03:52 +0200

> A driver should fill magic field of ethtool_eeprom struct in .get_eeprom
> and validate it in .set_eeprom. The bna incorrectly validates it in both
> and this makes its .get_eeprom interface unusable.
> 
> Signed-off-by: Ivan Vecera <ivecera@redhat.com>

Applied, thank you.

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

end of thread, other threads:[~2014-07-30 20:57 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-07-28 13:03 [PATCH net] bna: fill the magic in bnad_get_eeprom() instead of validating Ivan Vecera
2014-07-30 20:57 ` David Miller

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).