mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 18:51:56 -04:00
usb: gadget: f_gsi: bail out if opts is null
Currently, functions gsi_inst_clean & gsi_free_inst utilises gsi_opts without any check, however there is a possibility that the opts structure could become NULL. In such case, due to lack of if checks can result in NULL pointer dereference. Change-Id: I548690e2eee377b5292f258972ae7e38417f3085 Signed-off-by: Prashanth K <[email protected]>
This commit is contained in:
parent
0fc0638ba8
commit
63a32bf361
1 changed files with 4 additions and 1 deletions
|
|
@ -3849,6 +3849,9 @@ static struct config_item_type gsi_func_rmnet_type = {
|
|||
|
||||
static void gsi_inst_clean(struct gsi_opts *opts)
|
||||
{
|
||||
if (!opts)
|
||||
return;
|
||||
|
||||
if (opts->gsi->c_port.cdev.dev) {
|
||||
struct cdev *cdev = &opts->gsi->c_port.cdev;
|
||||
struct f_gsi *gsi = opts->gsi;
|
||||
|
|
@ -3962,7 +3965,7 @@ static void gsi_free_inst(struct usb_function_instance *f)
|
|||
enum ipa_usb_teth_prot prot_id;
|
||||
struct f_gsi *gsi;
|
||||
|
||||
if (!opts->gsi)
|
||||
if (!opts || !opts->gsi)
|
||||
return;
|
||||
|
||||
prot_id = opts->gsi->prot_id;
|
||||
|
|
|
|||
Loading…
Reference in a new issue