Closed Bug 1171464 Opened 9 years ago Closed 9 years ago

Check that socket isn't already closed before closing it

Categories

(Firefox OS Graveyard :: General, defect)

ARM
Gonk (Firefox OS)
defect
Not set
normal

Tracking

(firefox41 fixed)

RESOLVED FIXED
2.2 S14 (12june)
Tracking Status
firefox41 --- fixed

People

(Reporter: lanker, Assigned: lanker)

Details

Attachments

(1 file)

We have seen cases where mSocket ends up being null in RilConsumer::Close(), leading to a crash. I think this is what's happening:

RilConsumer::RilConsumer()
StreamSocket::Connect() fails
RilConsumer::OnConnectError()
RilConsumer::Close()
StreamSocket::Close()
RilConsumer::OnDisconnect()
StreamSocket::Connect() fails again
RilConsumer::Close() continues, setting mSocket to nullptr
RilConsumer::OnConnectError()
RilConsumer::Close()
-> mSocket == nullptr -> crash!

Adding a check in RilConsumer::Close() that mSocket != nullptr fixes this.
Thanks for reporting this bug. I'm currently working on refactoring this code. I'll fix the bug in the process.
Assignee: nobody → tzimmermann
Status: NEW → ASSIGNED
OK, good.

(I didn't see your comment before uploading the patch, you're to fast... ;))
Comment on attachment 8615319 [details] [diff] [review]
Bug_1171464-Check_that_socket_isnt_already_closed_before_closing_it.patch

Review of attachment 8615319 [details] [diff] [review]:
-----------------------------------------------------------------

Well, since you have a patch we can also fix it immediately. Do you need help with landing the fix?
Attachment #8615319 - Flags: review?(tzimmermann) → review+
Assignee: tzimmermann → fredrik.lanker
Yes, thank you.
I'll commit the patch after Kyle gave his r+.
Attachment #8615319 - Flags: review?(kyle) → review+
https://hg.mozilla.org/mozilla-central/rev/7cc8862ffd91
Status: ASSIGNED → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → 2.2 S14 (12june)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: