All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alexander Duyck <alexander.duyck@gmail.com>
To: intel-wired-lan@osuosl.org
Subject: [Intel-wired-lan] [PATCH v1 net-next 2/2] igb: support SIOCSMIIREG
Date: Thu, 07 May 2015 10:52:06 -0700	[thread overview]
Message-ID: <554BA646.1060000@gmail.com> (raw)
In-Reply-To: <1429302240-654-2-git-send-email-jtoppins@cumulusnetworks.com>

On 04/17/2015 01:24 PM, Jonathan Toppins wrote:
> From: Alan Liebthal <alanl@cumulusnetworks.com>
>
> Support setting the MII register via SIOCSMIIREG.
>
> Signed-off-by: Alan Liebthal <alanl@cumulusnetworks.com>
> Signed-off-by: Jonathan Toppins <jtoppins@cumulusnetworks.com>
> ---
>   drivers/net/ethernet/intel/igb/igb_main.c |    5 +++++
>   1 file changed, 5 insertions(+)
>
> diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c
> index 720b785..1071a71 100644
> --- a/drivers/net/ethernet/intel/igb/igb_main.c
> +++ b/drivers/net/ethernet/intel/igb/igb_main.c
> @@ -7141,6 +7141,11 @@ static int igb_mii_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd)
>   			return -EIO;
>   		break;
>   	case SIOCSMIIREG:
> +		adapter->hw.phy.addr = data->phy_id;
> +		if (igb_write_phy_reg(&adapter->hw, data->reg_num & 0x1F,
> +				      data->val_in))
> +			return -EIO;
> +		break;
>   	default:
>   		return -EOPNOTSUPP;
>   	}

How and why is this being used?  From what I can tell it looks like it 
is an easy way to break any of the existing interfaces if it is misused 
since all you would need to do is specify a phy address that doesn't 
match the existing PHY in the system and then you would likely lose 
link, or possibly mess up the configuration on the system requiring.

I suspect this is a back door for some piece of user space code that is 
being given far more permission than it should be.

- Alex

WARNING: multiple messages have this Message-ID (diff)
From: Alexander Duyck <alexander.duyck@gmail.com>
To: Jonathan Toppins <jtoppins@cumulusnetworks.com>,
	jeffrey.t.kirsher@intel.com
Cc: jesse.brandeburg@intel.com, shannon.nelson@intel.com,
	carolyn.wyborny@intel.com, donald.c.skidmore@intel.com,
	matthew.vick@intel.com, john.ronciak@intel.com,
	mitch.a.williams@intel.com, intel-wired-lan@lists.osuosl.org,
	netdev@vger.kernel.org, gospo@cumulusnetworks.com,
	shm@cumulusnetworks.com,
	Alan Liebthal <alanl@cumulusnetworks.com>
Subject: Re: [PATCH v1 net-next 2/2] igb: support SIOCSMIIREG
Date: Thu, 07 May 2015 10:52:06 -0700	[thread overview]
Message-ID: <554BA646.1060000@gmail.com> (raw)
In-Reply-To: <1429302240-654-2-git-send-email-jtoppins@cumulusnetworks.com>

On 04/17/2015 01:24 PM, Jonathan Toppins wrote:
> From: Alan Liebthal <alanl@cumulusnetworks.com>
>
> Support setting the MII register via SIOCSMIIREG.
>
> Signed-off-by: Alan Liebthal <alanl@cumulusnetworks.com>
> Signed-off-by: Jonathan Toppins <jtoppins@cumulusnetworks.com>
> ---
>   drivers/net/ethernet/intel/igb/igb_main.c |    5 +++++
>   1 file changed, 5 insertions(+)
>
> diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c
> index 720b785..1071a71 100644
> --- a/drivers/net/ethernet/intel/igb/igb_main.c
> +++ b/drivers/net/ethernet/intel/igb/igb_main.c
> @@ -7141,6 +7141,11 @@ static int igb_mii_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd)
>   			return -EIO;
>   		break;
>   	case SIOCSMIIREG:
> +		adapter->hw.phy.addr = data->phy_id;
> +		if (igb_write_phy_reg(&adapter->hw, data->reg_num & 0x1F,
> +				      data->val_in))
> +			return -EIO;
> +		break;
>   	default:
>   		return -EOPNOTSUPP;
>   	}

How and why is this being used?  From what I can tell it looks like it 
is an easy way to break any of the existing interfaces if it is misused 
since all you would need to do is specify a phy address that doesn't 
match the existing PHY in the system and then you would likely lose 
link, or possibly mess up the configuration on the system requiring.

I suspect this is a back door for some piece of user space code that is 
being given far more permission than it should be.

- Alex

  parent reply	other threads:[~2015-05-07 17:52 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-17 20:23 [Intel-wired-lan] [PATCH v1 net-next 1/2] igb: add PHY support for Broadcom 5461S Jonathan Toppins
2015-04-17 20:23 ` Jonathan Toppins
2015-04-17 20:24 ` [Intel-wired-lan] [PATCH v1 net-next 2/2] igb: support SIOCSMIIREG Jonathan Toppins
2015-04-17 20:24   ` Jonathan Toppins
2015-05-05 17:25   ` [Intel-wired-lan] " Brown, Aaron F
2015-05-05 17:25     ` Brown, Aaron F
2015-05-05 19:31     ` [Intel-wired-lan] " Jonathan Toppins
2015-05-05 19:31       ` Jonathan Toppins
2015-05-07 17:52   ` Alexander Duyck [this message]
2015-05-07 17:52     ` Alexander Duyck
2015-05-07 20:46     ` [Intel-wired-lan] " Rustad, Mark D
2015-05-07 20:46       ` Rustad, Mark D
2015-05-08 16:57       ` [Intel-wired-lan] " Jonathan Toppins
2015-05-08 16:57         ` Jonathan Toppins
2015-04-27 15:44 ` [Intel-wired-lan] [PATCH v1 net-next 1/2] igb: add PHY support for Broadcom 5461S Jonathan Toppins
2015-04-27 15:44   ` Jonathan Toppins
2015-05-02  1:45   ` [Intel-wired-lan] " Brown, Aaron F
2015-05-02  1:45     ` Brown, Aaron F
2015-05-07 11:49 ` [Intel-wired-lan] " Jeff Kirsher
2015-05-07 13:41   ` Andy Gospodarek
2015-05-07 17:49     ` Alexander Duyck
2015-05-08 16:39     ` Ronciak, John
2015-05-08 17:46       ` Andy Gospodarek
2015-05-08 21:32         ` Alexander Duyck
2015-05-08 21:42           ` Jonathan Toppins
2015-05-08 22:05             ` Alexander Duyck
2015-05-08 22:30               ` Jonathan Toppins
2015-05-08 23:06                 ` Alexander Duyck
2015-05-11 14:46           ` Andy Gospodarek
2015-05-07 16:32   ` Tim Harvey
2015-05-07 16:18 ` Tim Harvey
2015-05-07 16:18   ` Tim Harvey
2015-05-07 16:57   ` [Intel-wired-lan] " Jonathan Toppins
2015-05-07 16:57     ` Jonathan Toppins
2015-05-07 18:20 ` [Intel-wired-lan] " Alexander Duyck
2015-05-07 18:20   ` Alexander Duyck

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=554BA646.1060000@gmail.com \
    --to=alexander.duyck@gmail.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 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.