mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 11:11:45 -04:00
Drivers: hv: check vmbus_device_create() return value in vmbus_process_offer()
vmbus_device_create() result is not being checked in vmbus_process_offer() and it can fail if kzalloc() fails. Add the check and do minor cleanup to avoid additional duplication of "free_channel(); return;" block. Reported-by: Jason Wang <[email protected]> Signed-off-by: Vitaly Kuznetsov <[email protected]> Signed-off-by: K. Y. Srinivasan <[email protected]> Acked-by: Jason Wang <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
This commit is contained in:
parent
c3762b248f
commit
9c3a6f7e47
1 changed files with 9 additions and 5 deletions
|
|
@ -341,11 +341,10 @@ static void vmbus_process_offer(struct work_struct *work)
|
|||
if (channel->sc_creation_callback != NULL)
|
||||
channel->sc_creation_callback(newchannel);
|
||||
|
||||
return;
|
||||
goto out;
|
||||
}
|
||||
|
||||
free_channel(newchannel);
|
||||
return;
|
||||
goto err_free_chan;
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
@ -364,6 +363,8 @@ static void vmbus_process_offer(struct work_struct *work)
|
|||
&newchannel->offermsg.offer.if_type,
|
||||
&newchannel->offermsg.offer.if_instance,
|
||||
newchannel);
|
||||
if (!newchannel->device_obj)
|
||||
goto err_free_chan;
|
||||
|
||||
/*
|
||||
* Add the new device to the bus. This will kick off device-driver
|
||||
|
|
@ -379,9 +380,12 @@ static void vmbus_process_offer(struct work_struct *work)
|
|||
list_del(&newchannel->listentry);
|
||||
spin_unlock_irqrestore(&vmbus_connection.channel_lock, flags);
|
||||
kfree(newchannel->device_obj);
|
||||
|
||||
free_channel(newchannel);
|
||||
goto err_free_chan;
|
||||
}
|
||||
out:
|
||||
return;
|
||||
err_free_chan:
|
||||
free_channel(newchannel);
|
||||
}
|
||||
|
||||
enum {
|
||||
|
|
|
|||
Loading…
Reference in a new issue