Skip to content

Commit

Permalink
qlcnic: Fix panic while setting VF's MAC address
Browse files Browse the repository at this point in the history
o "qlcnic_sriov" structure pointer should be accessed only
  when SR-IOV is enabled. Access this pointer after SR-IOV
  PF check.

Signed-off-by: Manish Chopra <manish.chopra@qlogic.com>
Signed-off-by: Sucheta Chakraborty <sucheta.chakraborty@qlogic.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Manish Chopra authored and David S. Miller committed Jul 20, 2013
1 parent 8dc394a commit cab150b
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_pf.c
Original file line number Diff line number Diff line change
Expand Up @@ -1621,13 +1621,15 @@ int qlcnic_sriov_set_vf_mac(struct net_device *netdev, int vf, u8 *mac)
{
struct qlcnic_adapter *adapter = netdev_priv(netdev);
struct qlcnic_sriov *sriov = adapter->ahw->sriov;
int i, num_vfs = sriov->num_vfs;
int i, num_vfs;
struct qlcnic_vf_info *vf_info;
u8 *curr_mac;

if (!qlcnic_sriov_pf_check(adapter))
return -EOPNOTSUPP;

num_vfs = sriov->num_vfs;

if (!is_valid_ether_addr(mac) || vf >= num_vfs)
return -EINVAL;

Expand Down

0 comments on commit cab150b

Please sign in to comment.