modemmanager-next/samsung: Fix timer race in disconnect

When disconnecting, the previous logic flow was like this:

1.  Send disconenct command to modem.
2.  Get confirmation that the command was sent; set a timeout timer.
3.  Modem sends disconnect response; stop the timeout timer,
free the context.

However, in some cases, steps 2 qnd 3 were reversed so that the
function that stops the timer is called before the timer is set.
The result is that the timeout timer is not removed, and when it
expires, it operates on a freed context, leading to a crash.

The logic has been changed to set the timer earlier:

1.  Send disconenct command to modem; set the timeout timer.
2.  Get confirmation that the command was sent; if error,
stop the timeout timer, free the context.
3.  Modem sends disconnect response; stop the timeout timer,
free the context.

BUG=chromium-os:31743
TEST=ran cellular smoke test, which crashed before, but doesn't now.

Change-Id: Iac3d769655d69ea004c727eba7a3d8be14395101
1 file changed