netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] eth: sp7021: fix use after free bug in spl2sw_nvmem_get_mac_address
@ 2022-09-30  4:03 Zheng Wang
  2022-09-30 15:48 ` Jakub Kicinski
  0 siblings, 1 reply; 7+ messages in thread
From: Zheng Wang @ 2022-09-30  4:03 UTC (permalink / raw)
  To: netdev
  Cc: wellslutw, davem, linux-kernel, hackerzheng666, alex000young,
	security, edumazet, kuba, pabeni, Zheng Wang

This frees "mac" and tries to display its address as part of the error
message on the next line.  Swap the order.

Fixes: fd3040b9394c ("net: ethernet: Add driver for Sunplus SP7021")

Reported-by: Zheng Wang <hackerzheng666@gmail.com>

Signed-off-by: Zheng Wang <zyytlz.wz@163.com>
---
 drivers/net/ethernet/sunplus/spl2sw_driver.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/sunplus/spl2sw_driver.c b/drivers/net/ethernet/sunplus/spl2sw_driver.c
index 546206640492..61d1d07dc070 100644
--- a/drivers/net/ethernet/sunplus/spl2sw_driver.c
+++ b/drivers/net/ethernet/sunplus/spl2sw_driver.c
@@ -248,8 +248,8 @@ static int spl2sw_nvmem_get_mac_address(struct device *dev, struct device_node *
 
 	/* Check if mac address is valid */
 	if (!is_valid_ether_addr(mac)) {
-		kfree(mac);
 		dev_info(dev, "Invalid mac address in nvmem (%pM)!\n", mac);
+		kfree(mac);
 		return -EINVAL;
 	}
 
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH] eth: sp7021: fix use after free bug in spl2sw_nvmem_get_mac_address
  2022-09-30  4:03 Zheng Wang
@ 2022-09-30 15:48 ` Jakub Kicinski
  2022-09-30 17:23   ` Zheng Hacker
  0 siblings, 1 reply; 7+ messages in thread
From: Jakub Kicinski @ 2022-09-30 15:48 UTC (permalink / raw)
  To: Zheng Wang
  Cc: netdev, wellslutw, davem, linux-kernel, hackerzheng666,
	alex000young, security, edumazet, pabeni

On Fri, 30 Sep 2022 12:03:10 +0800 Zheng Wang wrote:
> This frees "mac" and tries to display its address as part of the error
> message on the next line.  Swap the order.
> 
> Fixes: fd3040b9394c ("net: ethernet: Add driver for Sunplus SP7021")
> 
> Reported-by: Zheng Wang <hackerzheng666@gmail.com>
> 
> Signed-off-by: Zheng Wang <zyytlz.wz@163.com>

Is there reporter and author the same person with different email
addresses or two people?


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] eth: sp7021: fix use after free bug in spl2sw_nvmem_get_mac_address
  2022-09-30 15:48 ` Jakub Kicinski
@ 2022-09-30 17:23   ` Zheng Hacker
  2022-09-30 17:25     ` Jakub Kicinski
  0 siblings, 1 reply; 7+ messages in thread
From: Zheng Hacker @ 2022-09-30 17:23 UTC (permalink / raw)
  To: Jakub Kicinski
  Cc: Zheng Wang, netdev, wellslutw, davem, linux-kernel, alex000young,
	security, edumazet, pabeni

> Is there reporter and author the same person with different email
> addresses or two people?
>

Hi Jakub,
Yes, its the same person from different email count.

Regards,
Zheng Wang

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] eth: sp7021: fix use after free bug in spl2sw_nvmem_get_mac_address
  2022-09-30 17:23   ` Zheng Hacker
@ 2022-09-30 17:25     ` Jakub Kicinski
  2022-09-30 17:55       ` Zheng Hacker
  0 siblings, 1 reply; 7+ messages in thread
From: Jakub Kicinski @ 2022-09-30 17:25 UTC (permalink / raw)
  To: Zheng Hacker
  Cc: Zheng Wang, netdev, wellslutw, davem, linux-kernel, alex000young,
	security, edumazet, pabeni

On Sat, 1 Oct 2022 01:23:52 +0800 Zheng Hacker wrote:
> > Is there reporter and author the same person with different email
> > addresses or two people?
> >  
> 
> Hi Jakub,
> Yes, its the same person from different email count.

Please repost without the Reported-by tag, then.
It's implied that you found the problem yourself
if there is no Reported-by tag.

Please remove the empty line between the Fixes
tag and you Signed-off-by tag.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] eth: sp7021: fix use after free bug in spl2sw_nvmem_get_mac_address
  2022-09-30 17:25     ` Jakub Kicinski
@ 2022-09-30 17:55       ` Zheng Hacker
  0 siblings, 0 replies; 7+ messages in thread
From: Zheng Hacker @ 2022-09-30 17:55 UTC (permalink / raw)
  To: Jakub Kicinski
  Cc: Zheng Wang, netdev, wellslutw, davem, linux-kernel, alex000young,
	security, edumazet, pabeni

> Please repost without the Reported-by tag, then.
> It's implied that you found the problem yourself
> if there is no Reported-by tag.
>
> Please remove the empty line between the Fixes
> tag and you Signed-off-by tag.

Hi Jakub,

I'll fix that and resend the patch right away. Thanks for your advice :)

Regards,
Zheng Wang

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH] eth: sp7021: fix use after free bug in spl2sw_nvmem_get_mac_address
@ 2022-09-30 17:57 Zheng Wang
  2022-10-03 11:50 ` patchwork-bot+netdevbpf
  0 siblings, 1 reply; 7+ messages in thread
From: Zheng Wang @ 2022-09-30 17:57 UTC (permalink / raw)
  To: netdev
  Cc: wellslutw, davem, linux-kernel, hackerzheng666, alex000young,
	security, edumazet, kuba, pabeni, Zheng Wang

This frees "mac" and tries to display its address as part of the error
message on the next line.  Swap the order.

Fixes: fd3040b9394c ("net: ethernet: Add driver for Sunplus SP7021")
Signed-off-by: Zheng Wang <zyytlz.wz@163.com>
---
 drivers/net/ethernet/sunplus/spl2sw_driver.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/sunplus/spl2sw_driver.c b/drivers/net/ethernet/sunplus/spl2sw_driver.c
index 546206640492..61d1d07dc070 100644
--- a/drivers/net/ethernet/sunplus/spl2sw_driver.c
+++ b/drivers/net/ethernet/sunplus/spl2sw_driver.c
@@ -248,8 +248,8 @@ static int spl2sw_nvmem_get_mac_address(struct device *dev, struct device_node *
 
 	/* Check if mac address is valid */
 	if (!is_valid_ether_addr(mac)) {
-		kfree(mac);
 		dev_info(dev, "Invalid mac address in nvmem (%pM)!\n", mac);
+		kfree(mac);
 		return -EINVAL;
 	}
 
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH] eth: sp7021: fix use after free bug in spl2sw_nvmem_get_mac_address
  2022-09-30 17:57 [PATCH] eth: sp7021: fix use after free bug in spl2sw_nvmem_get_mac_address Zheng Wang
@ 2022-10-03 11:50 ` patchwork-bot+netdevbpf
  0 siblings, 0 replies; 7+ messages in thread
From: patchwork-bot+netdevbpf @ 2022-10-03 11:50 UTC (permalink / raw)
  To: Zheng Wang
  Cc: netdev, wellslutw, davem, linux-kernel, hackerzheng666,
	alex000young, security, edumazet, kuba, pabeni

Hello:

This patch was applied to netdev/net.git (master)
by David S. Miller <davem@davemloft.net>:

On Sat,  1 Oct 2022 01:57:25 +0800 you wrote:
> This frees "mac" and tries to display its address as part of the error
> message on the next line.  Swap the order.
> 
> Fixes: fd3040b9394c ("net: ethernet: Add driver for Sunplus SP7021")
> Signed-off-by: Zheng Wang <zyytlz.wz@163.com>
> ---
>  drivers/net/ethernet/sunplus/spl2sw_driver.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Here is the summary with links:
  - eth: sp7021: fix use after free bug in spl2sw_nvmem_get_mac_address
    https://git.kernel.org/netdev/net/c/12aece8b0150

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2022-10-03 11:50 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-09-30 17:57 [PATCH] eth: sp7021: fix use after free bug in spl2sw_nvmem_get_mac_address Zheng Wang
2022-10-03 11:50 ` patchwork-bot+netdevbpf
  -- strict thread matches above, loose matches on Subject: below --
2022-09-30  4:03 Zheng Wang
2022-09-30 15:48 ` Jakub Kicinski
2022-09-30 17:23   ` Zheng Hacker
2022-09-30 17:25     ` Jakub Kicinski
2022-09-30 17:55       ` Zheng Hacker

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).