Netdev Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH] net: fddi: fix UAF in fza_probe
@ 2021-07-13 10:58 Pavel Skripkin
  2021-07-13 16:50 ` patchwork-bot+netdevbpf
  2021-07-13 16:59 ` Maciej W. Rozycki
  0 siblings, 2 replies; 3+ messages in thread
From: Pavel Skripkin @ 2021-07-13 10:58 UTC (permalink / raw)
  To: macro, davem; +Cc: netdev, linux-kernel, Pavel Skripkin

fp is netdev private data and it cannot be
used after free_netdev() call. Using fp after free_netdev()
can cause UAF bug. Fix it by moving free_netdev() after error message.

Fixes: 61414f5ec983 ("FDDI: defza: Add support for DEC FDDIcontroller 700
TURBOchannel adapter")
Signed-off-by: Pavel Skripkin <paskripkin@gmail.com>
---
 drivers/net/fddi/defza.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/net/fddi/defza.c b/drivers/net/fddi/defza.c
index 14f07050b6b1..0de2c4552f5e 100644
--- a/drivers/net/fddi/defza.c
+++ b/drivers/net/fddi/defza.c
@@ -1504,9 +1504,8 @@ static int fza_probe(struct device *bdev)
 	release_mem_region(start, len);
 
 err_out_kfree:
-	free_netdev(dev);
-
 	pr_err("%s: initialization failure, aborting!\n", fp->name);
+	free_netdev(dev);
 	return ret;
 }
 
-- 
2.32.0


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

* Re: [PATCH] net: fddi: fix UAF in fza_probe
  2021-07-13 10:58 [PATCH] net: fddi: fix UAF in fza_probe Pavel Skripkin
@ 2021-07-13 16:50 ` patchwork-bot+netdevbpf
  2021-07-13 16:59 ` Maciej W. Rozycki
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2021-07-13 16:50 UTC (permalink / raw)
  To: Pavel Skripkin; +Cc: macro, davem, netdev, linux-kernel

Hello:

This patch was applied to netdev/net.git (refs/heads/master):

On Tue, 13 Jul 2021 13:58:53 +0300 you wrote:
> fp is netdev private data and it cannot be
> used after free_netdev() call. Using fp after free_netdev()
> can cause UAF bug. Fix it by moving free_netdev() after error message.
> 
> Fixes: 61414f5ec983 ("FDDI: defza: Add support for DEC FDDIcontroller 700
> TURBOchannel adapter")
> Signed-off-by: Pavel Skripkin <paskripkin@gmail.com>
> 
> [...]

Here is the summary with links:
  - net: fddi: fix UAF in fza_probe
    https://git.kernel.org/netdev/net/c/deb7178eb940

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] 3+ messages in thread

* Re: [PATCH] net: fddi: fix UAF in fza_probe
  2021-07-13 10:58 [PATCH] net: fddi: fix UAF in fza_probe Pavel Skripkin
  2021-07-13 16:50 ` patchwork-bot+netdevbpf
@ 2021-07-13 16:59 ` Maciej W. Rozycki
  1 sibling, 0 replies; 3+ messages in thread
From: Maciej W. Rozycki @ 2021-07-13 16:59 UTC (permalink / raw)
  To: Pavel Skripkin; +Cc: davem, netdev, linux-kernel

On Tue, 13 Jul 2021, Pavel Skripkin wrote:

> fp is netdev private data and it cannot be
> used after free_netdev() call. Using fp after free_netdev()
> can cause UAF bug. Fix it by moving free_netdev() after error message.

 Can you justify the lines for a better layout?  The paragraph looks odd 
to me in its current form.

> Fixes: 61414f5ec983 ("FDDI: defza: Add support for DEC FDDIcontroller 700
> TURBOchannel adapter")
> Signed-off-by: Pavel Skripkin <paskripkin@gmail.com>

 Otherwise LGTM.  And a good catch, thank you!

Reviewed-by: Maciej W. Rozycki <macro@orcam.me.uk>

  Maciej

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

end of thread, other threads:[~2021-07-13 16:59 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-13 10:58 [PATCH] net: fddi: fix UAF in fza_probe Pavel Skripkin
2021-07-13 16:50 ` patchwork-bot+netdevbpf
2021-07-13 16:59 ` Maciej W. Rozycki

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).