linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] use-after-free issues in configfs
@ 2022-11-04 13:10 Sascha Hauer
  2022-11-04 13:10 ` [PATCH 1/2] usb: gadget: u_ether: Do not make UDC parent of the net device Sascha Hauer
  2022-11-04 13:10 ` [PATCH 2/2] usb: gadget: f_ecm: Always set current gadget in ecm_bind() Sascha Hauer
  0 siblings, 2 replies; 17+ messages in thread
From: Sascha Hauer @ 2022-11-04 13:10 UTC (permalink / raw)
  To: linux-usb; +Cc: Greg Kroah-Hartman, linux-kernel, kernel, Sascha Hauer

This series addresses a few problems with the users of the gether code.
The problem arises when a UDC is disconnected from a gadget created with
configfs doing a "echo '' > UDC". It seems the existing code is tested
up to the point where the gadget from configfs is up, tearing it down
still seems to make problems. I for myself am also not interested in tearing
it down, but I see use-after-free issues when doing a reboot -f.

The underlying problem is that the eth_dev returned by the gether code is used
for multiple bind/unbind cycles, but only initialized properly once.

The usb_gadget * is only valid between bind and unbind, so it is not a suitable
parent for the net_device whose lifetime spans multiple bind/unbind cycles.

I solved the issues for the f_ecm driver, similar problems exist in the other users
like f_eem or f_ncm as well. I can prepare patches for these once it's clear
that this is really the way to go.

Sascha Hauer (2):
  usb: gadget: u_ether: Do not make UDC parent of the net device
  usb: gadget: f_ecm: Always set current gadget in ecm_bind()

 drivers/usb/gadget/function/f_ecm.c   | 22 +++++++++-------------
 drivers/usb/gadget/function/u_ether.c |  4 ----
 2 files changed, 9 insertions(+), 17 deletions(-)

-- 
2.30.2


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

end of thread, other threads:[~2023-09-05  0:12 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-04 13:10 [PATCH 0/2] use-after-free issues in configfs Sascha Hauer
2022-11-04 13:10 ` [PATCH 1/2] usb: gadget: u_ether: Do not make UDC parent of the net device Sascha Hauer
2023-02-01 13:32   ` Paul Cercueil
2023-02-03 12:46     ` Linux kernel regression tracking (#adding)
2023-02-16 11:07       ` Linux regression tracking #update (Thorsten Leemhuis)
2023-02-08 12:06     ` Greg Kroah-Hartman
2023-02-08 13:45       ` Paul Cercueil
2023-02-09 10:18     ` Sascha Hauer
2023-02-09 10:37       ` Paul Cercueil
2023-02-09 11:41         ` Sascha Hauer
2023-02-09 15:05           ` Alan Stern
2023-02-10 14:49             ` Sascha Hauer
2023-02-10 15:45               ` Alan Stern
2023-02-10 18:46                 ` Sascha Hauer
2023-09-04 13:14   ` Ondřej Jirman
2023-09-05  0:12     ` Ondřej Jirman
2022-11-04 13:10 ` [PATCH 2/2] usb: gadget: f_ecm: Always set current gadget in ecm_bind() Sascha Hauer

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