From: Jacob Keller <jacob.e.keller@intel.com>
To: Chris Packham <Chris.Packham@alliedtelesis.co.nz>,
Jackie Jone <Jackie.Jone@alliedtelesis.co.nz>,
"davem@davemloft.net" <davem@davemloft.net>
Cc: "jesse.brandeburg@intel.com" <jesse.brandeburg@intel.com>,
"anthony.l.nguyen@intel.com" <anthony.l.nguyen@intel.com>,
"kuba@kernel.org" <kuba@kernel.org>,
"intel-wired-lan@lists.osuosl.org"
<intel-wired-lan@lists.osuosl.org>,
"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] igb: Add MII write support
Date: Wed, 5 Jun 2024 14:16:47 -0700 [thread overview]
Message-ID: <4f9af0e9-5ce0-4b76-a2cd-cbd37331d869@intel.com> (raw)
In-Reply-To: <dce11b71-724c-4c5f-bc95-1b59e7cc7844@alliedtelesis.co.nz>
On 6/5/2024 2:10 PM, Chris Packham wrote:
>
> On 6/06/24 08:51, Jacob Keller wrote:
>>
>> On 6/3/2024 8:10 PM, jackie.jone@alliedtelesis.co.nz wrote:
>>> From: Jackie Jone <jackie.jone@alliedtelesis.co.nz>
>>>
>>> To facilitate running PHY parametric tests, add support for the SIOCSMIIREG
>>> ioctl. This allows a userspace application to write to the PHY registers
>>> to enable the test modes.
>>>
>>> Signed-off-by: Jackie Jone <jackie.jone@alliedtelesis.co.nz>
>>> ---
>>> drivers/net/ethernet/intel/igb/igb_main.c | 4 ++++
>>> 1 file changed, 4 insertions(+)
>>>
>>> diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c
>>> index 03a4da6a1447..7fbfcf01fbf9 100644
>>> --- a/drivers/net/ethernet/intel/igb/igb_main.c
>>> +++ b/drivers/net/ethernet/intel/igb/igb_main.c
>>> @@ -8977,6 +8977,10 @@ static int igb_mii_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd)
>>> return -EIO;
>>> break;
>>> case SIOCSMIIREG:
>>> + if (igb_write_phy_reg(&adapter->hw, data->reg_num & 0x1F,
>>> + data->val_in))
>>> + return -EIO;
>>> + break;
>> A handful of drivers seem to expose this. What are the consequences of
>> exposing this ioctl? What can user space do with it?
>>
>> It looks like a few drivers also check something like CAP_NET_ADMIN to
>> avoid allowing write access to all users. Is that enforced somewhere else?
>
> CAP_NET_ADMIN is enforced via dev_ioctl() so it should already be
> restricted to users with that capability.
Ok good. That at least limits this so that random users can't cause any
side effects.
I'm not super familiar with what can be affected by writing the MII
registers. I'm also not sure what the community thinks of exposing such
access directly.
From the description this is intended to use for debugging and testing
purposes?
next prev parent reply other threads:[~2024-06-05 21:17 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-04 3:10 jackie.jone
2024-06-05 20:51 ` Jacob Keller
2024-06-05 21:10 ` Chris Packham
2024-06-05 21:16 ` Jacob Keller [this message]
2024-06-05 21:30 ` Chris Packham
2024-06-06 4:30 ` [Intel-wired-lan] " Loktionov, Aleksandr
2024-06-06 15:41 ` Andrew Lunn
2024-06-06 16:56 ` Jacob Keller
2024-06-06 18:31 ` Andrew Lunn
2024-06-06 18:39 ` Jacob Keller
2024-06-11 11:08 ` [Intel-wired-lan] " Pucha, HimasekharX Reddy
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=4f9af0e9-5ce0-4b76-a2cd-cbd37331d869@intel.com \
--to=jacob.e.keller@intel.com \
--cc=Chris.Packham@alliedtelesis.co.nz \
--cc=Jackie.Jone@alliedtelesis.co.nz \
--cc=anthony.l.nguyen@intel.com \
--cc=davem@davemloft.net \
--cc=intel-wired-lan@lists.osuosl.org \
--cc=jesse.brandeburg@intel.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.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
all inboxes | Powered by JetHome®