Skip to contentSkip to conversation

radio-mr800: fix radio->muted and radio->stereo

PATCH New Alexey Klimov 1 participant 1 message Jan 24, 2009 Media (V4L/DVB)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 radio-mr800: fix radio->muted and radio->stereo

Hello, Mauro

This is simple fix for mr800 usb radio driver.
It would be great to have it in next upstream pull request if you don't mind.

---
Move radio->muted and radio->stereo in section where radio mutex is locked to avoid possible race condition problems or access to memory. Thanks to David Ellingsworth <[email protected]> for pointing to this weak place in driver.

--

linux/drivers/media/radio/radio-mr800.c +6 -6
diff -r 6a6eb9efc6cd linux/drivers/media/radio/radio-mr800.c
@@ -197,9 +197,9 @@
 		return retval;
 	}
 
+	radio->muted = 0;
+
 	mutex_unlock(&radio->lock);
-
-	radio->muted = 0;
 
 	return retval;
 }
@@ -233,9 +233,9 @@
 		return retval;
 	}
 
+	radio->muted = 1;
+
 	mutex_unlock(&radio->lock);
-
-	radio->muted = 1;
 
 	return retval;
 }
@@ -287,9 +287,9 @@
 		return retval;
 	}
 
+	radio->stereo = 0;
+
 	mutex_unlock(&radio->lock);
-
-	radio->stereo = 0;
 
 	return retval;
 }
Signature · 1 line
Best regards, Klimov Alexey