* [Intel-wired-lan] [PATCH] ethernet: e1000e: Fix possible uninit bug
@ 2023-07-05 0:10 Yu Hao
2023-07-05 15:47 ` Neftin, Sasha
2023-07-10 8:13 ` Denis Kirjanov
0 siblings, 2 replies; 7+ messages in thread
From: Yu Hao @ 2023-07-05 0:10 UTC (permalink / raw)
To: jesse.brandeburg, anthony.l.nguyen, davem, edumazet, kuba, pabeni,
intel-wired-lan, netdev, linux-kernel
The variable phy_data should be initialized in function e1e_rphy.
However, there is not return value check, which means there is a
possible uninit read later for the variable.
Signed-off-by: Yu Hao <yhao016@ucr.edu>
---
drivers/net/ethernet/intel/e1000e/netdev.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/intel/e1000e/netdev.c
b/drivers/net/ethernet/intel/e1000e/netdev.c
index 771a3c909c45..455af5e55cc6 100644
--- a/drivers/net/ethernet/intel/e1000e/netdev.c
+++ b/drivers/net/ethernet/intel/e1000e/netdev.c
@@ -6910,8 +6910,11 @@ static int __e1000_resume(struct pci_dev *pdev)
/* report the system wakeup cause from S3/S4 */
if (adapter->flags2 & FLAG2_HAS_PHY_WAKEUP) {
u16 phy_data;
+ s32 ret_val;
- e1e_rphy(&adapter->hw, BM_WUS, &phy_data);
+ ret_val = e1e_rphy(&adapter->hw, BM_WUS, &phy_data);
+ if (ret_val)
+ return ret_val;
if (phy_data) {
e_info("PHY Wakeup cause - %s\n",
phy_data & E1000_WUS_EX ? "Unicast Packet" :
--
2.34.1
_______________________________________________
Intel-wired-lan mailing list
Intel-wired-lan@osuosl.org
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [Intel-wired-lan] [PATCH] ethernet: e1000e: Fix possible uninit bug
2023-07-05 0:10 [Intel-wired-lan] [PATCH] ethernet: e1000e: Fix possible uninit bug Yu Hao
@ 2023-07-05 15:47 ` Neftin, Sasha
2023-07-10 0:55 ` Yu Hao
2023-07-10 8:13 ` Denis Kirjanov
1 sibling, 1 reply; 7+ messages in thread
From: Neftin, Sasha @ 2023-07-05 15:47 UTC (permalink / raw)
To: Yu Hao, jesse.brandeburg, anthony.l.nguyen, davem, edumazet, kuba,
pabeni, intel-wired-lan, netdev, linux-kernel, Ruinskiy, Dima,
Edri, Michael
On 7/5/2023 03:10, Yu Hao wrote:
> The variable phy_data should be initialized in function e1e_rphy.
> However, there is not return value check, which means there is a
> possible uninit read later for the variable.
>
> Signed-off-by: Yu Hao <yhao016@ucr.edu>
> ---
> drivers/net/ethernet/intel/e1000e/netdev.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/ethernet/intel/e1000e/netdev.c
> b/drivers/net/ethernet/intel/e1000e/netdev.c
> index 771a3c909c45..455af5e55cc6 100644
> --- a/drivers/net/ethernet/intel/e1000e/netdev.c
> +++ b/drivers/net/ethernet/intel/e1000e/netdev.c
> @@ -6910,8 +6910,11 @@ static int __e1000_resume(struct pci_dev *pdev)
> /* report the system wakeup cause from S3/S4 */
> if (adapter->flags2 & FLAG2_HAS_PHY_WAKEUP) {
> u16 phy_data;
> + s32 ret_val;
why just not initialize u16 phy_data = 0? How did it hurt us? (legacy)
>
> - e1e_rphy(&adapter->hw, BM_WUS, &phy_data);
> + ret_val = e1e_rphy(&adapter->hw, BM_WUS, &phy_data);
> + if (ret_val)
> + return ret_val;
> if (phy_data) {
> e_info("PHY Wakeup cause - %s\n",
> phy_data & E1000_WUS_EX ? "Unicast Packet" :
_______________________________________________
Intel-wired-lan mailing list
Intel-wired-lan@osuosl.org
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [Intel-wired-lan] [PATCH] ethernet: e1000e: Fix possible uninit bug
2023-07-05 15:47 ` Neftin, Sasha
@ 2023-07-10 0:55 ` Yu Hao
2023-07-10 7:55 ` Neftin, Sasha
0 siblings, 1 reply; 7+ messages in thread
From: Yu Hao @ 2023-07-10 0:55 UTC (permalink / raw)
To: Neftin, Sasha
Cc: Ruinskiy, Dima, intel-wired-lan, jesse.brandeburg, linux-kernel,
Edri, Michael, edumazet, anthony.l.nguyen, netdev, kuba, pabeni,
davem
I think u16 phy_data = 0 would not hurt us.
Let me submit a patch which just initializes u16 phy_data = 0.
Yu Hao
On Wed, Jul 5, 2023 at 8:47 AM Neftin, Sasha <sasha.neftin@intel.com> wrote:
>
> On 7/5/2023 03:10, Yu Hao wrote:
> > The variable phy_data should be initialized in function e1e_rphy.
> > However, there is not return value check, which means there is a
> > possible uninit read later for the variable.
> >
> > Signed-off-by: Yu Hao <yhao016@ucr.edu>
> > ---
> > drivers/net/ethernet/intel/e1000e/netdev.c | 5 ++++-
> > 1 file changed, 4 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/net/ethernet/intel/e1000e/netdev.c
> > b/drivers/net/ethernet/intel/e1000e/netdev.c
> > index 771a3c909c45..455af5e55cc6 100644
> > --- a/drivers/net/ethernet/intel/e1000e/netdev.c
> > +++ b/drivers/net/ethernet/intel/e1000e/netdev.c
> > @@ -6910,8 +6910,11 @@ static int __e1000_resume(struct pci_dev *pdev)
> > /* report the system wakeup cause from S3/S4 */
> > if (adapter->flags2 & FLAG2_HAS_PHY_WAKEUP) {
> > u16 phy_data;
> > + s32 ret_val;
>
> why just not initialize u16 phy_data = 0? How did it hurt us? (legacy)
>
> >
> > - e1e_rphy(&adapter->hw, BM_WUS, &phy_data);
> > + ret_val = e1e_rphy(&adapter->hw, BM_WUS, &phy_data);
> > + if (ret_val)
> > + return ret_val;
> > if (phy_data) {
> > e_info("PHY Wakeup cause - %s\n",
> > phy_data & E1000_WUS_EX ? "Unicast Packet" :
>
_______________________________________________
Intel-wired-lan mailing list
Intel-wired-lan@osuosl.org
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Intel-wired-lan] [PATCH] ethernet: e1000e: Fix possible uninit bug
@ 2023-07-10 0:57 Yu Hao
2023-07-10 4:02 ` Pavan Chebbi
0 siblings, 1 reply; 7+ messages in thread
From: Yu Hao @ 2023-07-10 0:57 UTC (permalink / raw)
Cc: Paolo Abeni, intel-wired-lan, Jesse Brandeburg, linux-kernel,
Eric Dumazet, Tony Nguyen, netdev, Jakub Kicinski, Yu Hao,
David S. Miller
The variable phy_data should be initialized in function e1e_rphy.
However, there is not return value check, which means there is a
possible uninit read later for the variable.
Signed-off-by: Yu Hao <yhao016@ucr.edu>
---
drivers/net/ethernet/intel/e1000e/netdev.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/intel/e1000e/netdev.c b/drivers/net/ethernet/intel/e1000e/netdev.c
index 771a3c909c45..a807358a8174 100644
--- a/drivers/net/ethernet/intel/e1000e/netdev.c
+++ b/drivers/net/ethernet/intel/e1000e/netdev.c
@@ -6909,7 +6909,7 @@ static int __e1000_resume(struct pci_dev *pdev)
/* report the system wakeup cause from S3/S4 */
if (adapter->flags2 & FLAG2_HAS_PHY_WAKEUP) {
- u16 phy_data;
+ u16 phy_data = 0;
e1e_rphy(&adapter->hw, BM_WUS, &phy_data);
if (phy_data) {
--
2.34.1
_______________________________________________
Intel-wired-lan mailing list
Intel-wired-lan@osuosl.org
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [Intel-wired-lan] [PATCH] ethernet: e1000e: Fix possible uninit bug
2023-07-10 0:57 Yu Hao
@ 2023-07-10 4:02 ` Pavan Chebbi
0 siblings, 0 replies; 7+ messages in thread
From: Pavan Chebbi @ 2023-07-10 4:02 UTC (permalink / raw)
To: Yu Hao
Cc: intel-wired-lan, Jesse Brandeburg, linux-kernel, Eric Dumazet,
Tony Nguyen, netdev, Jakub Kicinski, Paolo Abeni, David S. Miller
[-- Attachment #1.1: Type: text/plain, Size: 1216 bytes --]
On Mon, Jul 10, 2023 at 6:27 AM Yu Hao <yhao016@ucr.edu> wrote:
>
> The variable phy_data should be initialized in function e1e_rphy.
> However, there is not return value check, which means there is a
> possible uninit read later for the variable.
>
> Signed-off-by: Yu Hao <yhao016@ucr.edu>
> ---
Shouldn't this be a v2? You are addressing a comment on your original
patch right?
Also please specify the target tree name. This may need a fixes tag also.
> drivers/net/ethernet/intel/e1000e/netdev.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/ethernet/intel/e1000e/netdev.c b/drivers/net/ethernet/intel/e1000e/netdev.c
> index 771a3c909c45..a807358a8174 100644
> --- a/drivers/net/ethernet/intel/e1000e/netdev.c
> +++ b/drivers/net/ethernet/intel/e1000e/netdev.c
> @@ -6909,7 +6909,7 @@ static int __e1000_resume(struct pci_dev *pdev)
>
> /* report the system wakeup cause from S3/S4 */
> if (adapter->flags2 & FLAG2_HAS_PHY_WAKEUP) {
> - u16 phy_data;
> + u16 phy_data = 0;
>
> e1e_rphy(&adapter->hw, BM_WUS, &phy_data);
> if (phy_data) {
> --
> 2.34.1
>
>
[-- Attachment #1.2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4209 bytes --]
[-- Attachment #2: Type: text/plain, Size: 162 bytes --]
_______________________________________________
Intel-wired-lan mailing list
Intel-wired-lan@osuosl.org
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [Intel-wired-lan] [PATCH] ethernet: e1000e: Fix possible uninit bug
2023-07-10 0:55 ` Yu Hao
@ 2023-07-10 7:55 ` Neftin, Sasha
0 siblings, 0 replies; 7+ messages in thread
From: Neftin, Sasha @ 2023-07-10 7:55 UTC (permalink / raw)
To: Yu Hao
Cc: Ruinskiy, Dima, intel-wired-lan, jesse.brandeburg, linux-kernel,
Edri, Michael, edumazet, anthony.l.nguyen, netdev, kuba, pabeni,
davem
On 7/10/2023 03:55, Yu Hao wrote:
> I think u16 phy_data = 0 would not hurt us.
> Let me submit a patch which just initializes u16 phy_data = 0.
Good.
>
> Yu Hao
>
> On Wed, Jul 5, 2023 at 8:47 AM Neftin, Sasha <sasha.neftin@intel.com> wrote:
>>
>> On 7/5/2023 03:10, Yu Hao wrote:
>>> The variable phy_data should be initialized in function e1e_rphy.
>>> However, there is not return value check, which means there is a
>>> possible uninit read later for the variable.
>>>
>>> Signed-off-by: Yu Hao <yhao016@ucr.edu>
>>> ---
>>> drivers/net/ethernet/intel/e1000e/netdev.c | 5 ++++-
>>> 1 file changed, 4 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/drivers/net/ethernet/intel/e1000e/netdev.c
>>> b/drivers/net/ethernet/intel/e1000e/netdev.c
>>> index 771a3c909c45..455af5e55cc6 100644
>>> --- a/drivers/net/ethernet/intel/e1000e/netdev.c
>>> +++ b/drivers/net/ethernet/intel/e1000e/netdev.c
>>> @@ -6910,8 +6910,11 @@ static int __e1000_resume(struct pci_dev *pdev)
>>> /* report the system wakeup cause from S3/S4 */
>>> if (adapter->flags2 & FLAG2_HAS_PHY_WAKEUP) {
>>> u16 phy_data;
>>> + s32 ret_val;
>>
>> why just not initialize u16 phy_data = 0? How did it hurt us? (legacy)
>>
>>>
>>> - e1e_rphy(&adapter->hw, BM_WUS, &phy_data);
>>> + ret_val = e1e_rphy(&adapter->hw, BM_WUS, &phy_data);
>>> + if (ret_val)
>>> + return ret_val;
>>> if (phy_data) {
>>> e_info("PHY Wakeup cause - %s\n",
>>> phy_data & E1000_WUS_EX ? "Unicast Packet" :
>>
_______________________________________________
Intel-wired-lan mailing list
Intel-wired-lan@osuosl.org
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [Intel-wired-lan] [PATCH] ethernet: e1000e: Fix possible uninit bug
2023-07-05 0:10 [Intel-wired-lan] [PATCH] ethernet: e1000e: Fix possible uninit bug Yu Hao
2023-07-05 15:47 ` Neftin, Sasha
@ 2023-07-10 8:13 ` Denis Kirjanov
1 sibling, 0 replies; 7+ messages in thread
From: Denis Kirjanov @ 2023-07-10 8:13 UTC (permalink / raw)
To: Yu Hao, jesse.brandeburg, anthony.l.nguyen, davem, edumazet, kuba,
pabeni, intel-wired-lan, netdev, linux-kernel
On 7/5/23 03:10, Yu Hao wrote:
> The variable phy_data should be initialized in function e1e_rphy.
> However, there is not return value check, which means there is a
> possible uninit read later for the variable.
>
> Signed-off-by: Yu Hao <yhao016@ucr.edu>
> ---
> drivers/net/ethernet/intel/e1000e/netdev.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/ethernet/intel/e1000e/netdev.c
> b/drivers/net/ethernet/intel/e1000e/netdev.c
> index 771a3c909c45..455af5e55cc6 100644
> --- a/drivers/net/ethernet/intel/e1000e/netdev.c
> +++ b/drivers/net/ethernet/intel/e1000e/netdev.c
> @@ -6910,8 +6910,11 @@ static int __e1000_resume(struct pci_dev *pdev)
> /* report the system wakeup cause from S3/S4 */
> if (adapter->flags2 & FLAG2_HAS_PHY_WAKEUP) {
> u16 phy_data;
> + s32 ret_val;
>
> - e1e_rphy(&adapter->hw, BM_WUS, &phy_data);
> + ret_val = e1e_rphy(&adapter->hw, BM_WUS, &phy_data);
> + if (ret_val)
> + return ret_val;
> if (phy_data) {
> e_info("PHY Wakeup cause - %s\n",
> phy_data & E1000_WUS_EX ? "Unicast Packet" :
the same case appears in other places in the driver like e1000_setup_rctl()
_______________________________________________
Intel-wired-lan mailing list
Intel-wired-lan@osuosl.org
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2023-07-10 15:22 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-07-05 0:10 [Intel-wired-lan] [PATCH] ethernet: e1000e: Fix possible uninit bug Yu Hao
2023-07-05 15:47 ` Neftin, Sasha
2023-07-10 0:55 ` Yu Hao
2023-07-10 7:55 ` Neftin, Sasha
2023-07-10 8:13 ` Denis Kirjanov
-- strict thread matches above, loose matches on Subject: below --
2023-07-10 0:57 Yu Hao
2023-07-10 4:02 ` Pavan Chebbi
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox