Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 99392dcd authored by Chandana Kishori Chiluveru's avatar Chandana Kishori Chiluveru
Browse files

usb: gadget: Fix null pointer crash issue in gsi_free_inst



If misc register failed then there is a chance for accessing the
null pointer in gsi_free_inst function and leads to target crash.
Hence add the change to handle the same.

Change-Id: Iaa3f7db1403ca2d87f259dec109912c5437c24f4
Signed-off-by: default avatarChandana Kishori Chiluveru <cchiluve@codeaurora.org>
parent e51c3cc8
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -3007,6 +3007,9 @@ static void gsi_free_inst(struct usb_function_instance *f)
{
	struct gsi_opts *opts = container_of(f, struct gsi_opts, func_inst);

	if (!opts->gsi)
		return;

	if (opts->gsi->c_port.ctrl_device.fops)
		misc_deregister(&opts->gsi->c_port.ctrl_device);