diff options
| author | Chandana Kishori Chiluveru <cchiluve@codeaurora.org> | 2016-12-30 17:26:09 +0530 |
|---|---|---|
| committer | Chandana Kishori Chiluveru <cchiluve@codeaurora.org> | 2017-01-09 11:40:22 +0530 |
| commit | 99392dcd7d673f673d08c6eaaac00a05d6ac9300 (patch) | |
| tree | ffeaa81f657b8fec0c75e2d1f9cb926084ee3f01 /drivers | |
| parent | e51c3cc83f3f3accec602f94723d8ce60a2f6e65 (diff) | |
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: Chandana Kishori Chiluveru <cchiluve@codeaurora.org>
Diffstat (limited to 'drivers')
| -rw-r--r-- | drivers/usb/gadget/function/f_gsi.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/usb/gadget/function/f_gsi.c b/drivers/usb/gadget/function/f_gsi.c index 47e077d180ec..b3d223a76f07 100644 --- a/drivers/usb/gadget/function/f_gsi.c +++ b/drivers/usb/gadget/function/f_gsi.c @@ -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); |
