Intel-Wired-Lan Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Tony Nguyen <anthony.l.nguyen@intel.com>
To: intel-wired-lan@osuosl.org
Subject: [Intel-wired-lan] [PATCH S33 05/15] ice: fix stack leakage
Date: Fri,  8 Nov 2019 06:23:21 -0800	[thread overview]
Message-ID: <20191108142331.10221-5-anthony.l.nguyen@intel.com> (raw)
In-Reply-To: <20191108142331.10221-1-anthony.l.nguyen@intel.com>

From: Jesse Brandeburg <jesse.brandeburg@intel.com>

In the case of an invalid virtchannel request the driver
would return uninitialized data to the VF from the PF stack
which is a bug.  Fix by initializing the stack variable
earlier in the function before any return paths can be taken.

Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
---
 drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c b/drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c
index fd419230a6c0..f8d26674cf5a 100644
--- a/drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c
+++ b/drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c
@@ -1886,8 +1886,8 @@ static int ice_vc_get_stats_msg(struct ice_vf *vf, u8 *msg)
 	enum virtchnl_status_code v_ret = VIRTCHNL_STATUS_SUCCESS;
 	struct virtchnl_queue_select *vqs =
 		(struct virtchnl_queue_select *)msg;
+	struct ice_eth_stats stats = { 0 };
 	struct ice_pf *pf = vf->pf;
-	struct ice_eth_stats stats;
 	struct ice_vsi *vsi;
 
 	if (!test_bit(ICE_VF_STATE_ACTIVE, vf->vf_states)) {
@@ -1906,7 +1906,6 @@ static int ice_vc_get_stats_msg(struct ice_vf *vf, u8 *msg)
 		goto error_param;
 	}
 
-	memset(&stats, 0, sizeof(struct ice_eth_stats));
 	ice_update_eth_stats(vsi);
 
 	stats = vsi->eth_stats;
-- 
2.20.1


  parent reply	other threads:[~2019-11-08 14:23 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-08 14:23 [Intel-wired-lan] [PATCH S33 01/15] ice: Store number of functions for the device Tony Nguyen
2019-11-08 14:23 ` [Intel-wired-lan] [PATCH S33 02/15] ice: Correct capabilities reporting of max TCs Tony Nguyen
2019-11-12 19:30   ` Bowers, AndrewX
2019-11-08 14:23 ` [Intel-wired-lan] [PATCH S33 03/15] ice: Disallow VF VLAN opcodes if VLAN offloads disabled Tony Nguyen
2019-11-12 19:31   ` Bowers, AndrewX
2019-11-08 14:23 ` [Intel-wired-lan] [PATCH S33 04/15] ice: Don't modify stripping for add/del VLANs on VF Tony Nguyen
2019-11-12 19:32   ` Bowers, AndrewX
2019-11-08 14:23 ` Tony Nguyen [this message]
2019-11-12 19:32   ` [Intel-wired-lan] [PATCH S33 05/15] ice: fix stack leakage Bowers, AndrewX
2019-11-08 14:23 ` [Intel-wired-lan] [PATCH S33 06/15] ice: Only disable VF state when freeing each VF resources Tony Nguyen
2019-11-12 19:33   ` Bowers, AndrewX
2019-11-08 14:23 ` [Intel-wired-lan] [PATCH S33 07/15] ice: Fix setting coalesce to handle DCB configuration Tony Nguyen
2019-11-12 19:33   ` Bowers, AndrewX
2019-11-08 14:23 ` [Intel-wired-lan] [PATCH S33 08/15] ice: Refactor removal of VLAN promiscuous rules Tony Nguyen
2019-11-12 19:34   ` Bowers, AndrewX
2019-11-08 14:23 ` [Intel-wired-lan] [PATCH S33 09/15] ice: Do not use devm* functions for local uses Tony Nguyen
2019-11-12 19:34   ` Bowers, AndrewX
2019-11-08 14:23 ` [Intel-wired-lan] [PATCH S33 10/15] ice: Add ice_pf_to_dev(pf) macro Tony Nguyen
2019-11-12 19:35   ` Bowers, AndrewX
2019-11-08 14:23 ` [Intel-wired-lan] [PATCH S33 11/15] ice: add helpers for virtchnl Tony Nguyen
2019-11-12 19:35   ` Bowers, AndrewX
2019-11-08 14:23 ` [Intel-wired-lan] [PATCH S33 12/15] ice: implement VF stats NDO Tony Nguyen
2019-11-12 19:35   ` Bowers, AndrewX
2019-11-08 14:23 ` [Intel-wired-lan] [PATCH S33 13/15] ice: Implement ethtool ops for channels Tony Nguyen
2019-11-12 19:36   ` Bowers, AndrewX
2019-11-08 14:23 ` [Intel-wired-lan] [PATCH S33 14/15] ice: remove pointless NULL check of port_info Tony Nguyen
2019-11-12 19:36   ` Bowers, AndrewX
2019-11-08 14:23 ` [Intel-wired-lan] [PATCH S33 15/15] ice: Update FW API minor version Tony Nguyen
2019-11-12 19:37   ` Bowers, AndrewX
2019-11-12 19:30 ` [Intel-wired-lan] [PATCH S33 01/15] ice: Store number of functions for the device Bowers, AndrewX

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191108142331.10221-5-anthony.l.nguyen@intel.com \
    --to=anthony.l.nguyen@intel.com \
    --cc=intel-wired-lan@osuosl.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox