From patchwork Sat Jan 24 05:07:04 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexey Klimov X-Patchwork-Id: 3851 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n0O56oHp001367 for ; Sat, 24 Jan 2009 05:06:50 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750719AbZAXFGt (ORCPT ); Sat, 24 Jan 2009 00:06:49 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1750725AbZAXFGt (ORCPT ); Sat, 24 Jan 2009 00:06:49 -0500 Received: from fg-out-1718.google.com ([72.14.220.153]:32259 "EHLO fg-out-1718.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750719AbZAXFGs (ORCPT ); Sat, 24 Jan 2009 00:06:48 -0500 Received: by fg-out-1718.google.com with SMTP id 19so2786404fgg.17 for ; Fri, 23 Jan 2009 21:06:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:subject:from:to:cc :content-type:date:message-id:mime-version:x-mailer :content-transfer-encoding; bh=uerdFuOZgCzTUK+/7Wq1OMIqoBvaxTGZELgktGG+qeg=; b=juiuHvumulBeTVHPm2yiEnIS47WBOJtef8Q3deMYI70OcqwpQaHoQAEjF9idhTNZUZ vRP3zUkE4CESQgUi8u6q9ULZWLBWk99ovtBuSvOGmNaGWmUpJcQg//a6FwwGGUY4h8xR wDzseRGI3pVObVszOgDXHEvNna3ConhHTi5Nc= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=subject:from:to:cc:content-type:date:message-id:mime-version :x-mailer:content-transfer-encoding; b=NrZPFnztWJdNs2Lqy2Ia4zriMgG/3OxemjKDBYoQF4LsvOB0kD3SYDZTYK2omKExua aIgVISYYifUekUQ5N5M72Yc7qop4m86Jc+3UHKorRMmGIhQ8Bthmcl7QL7BvdeR2T1RH NDqECttT+tnVdpT4RNQZrVfK6ppsJIFAwg7M0= Received: by 10.86.70.3 with SMTP id s3mr227170fga.25.1232773605790; Fri, 23 Jan 2009 21:06:45 -0800 (PST) Received: from ?192.168.1.42? (gw.zunet.ru [217.67.117.64]) by mx.google.com with ESMTPS id 4sm4345042fgg.54.2009.01.23.21.06.44 (version=SSLv3 cipher=RC4-MD5); Fri, 23 Jan 2009 21:06:45 -0800 (PST) Subject: [PATCH] radio-mr800: fix radio->muted and radio->stereo From: Alexey Klimov To: Mauro Carvalho Chehab , Douglas Schilling Landgraf Cc: linux-media@vger.kernel.org Date: Sat, 24 Jan 2009 08:07:04 +0300 Message-Id: <1232773624.6320.17.camel@tux.localhost> Mime-Version: 1.0 X-Mailer: Evolution 2.24.2 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org 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 for pointing to this weak place in driver. Signed-off-by: Alexey Klimov -- diff -r 6a6eb9efc6cd linux/drivers/media/radio/radio-mr800.c --- a/linux/drivers/media/radio/radio-mr800.c Fri Jan 23 22:35:12 2009 -0200 +++ b/linux/drivers/media/radio/radio-mr800.c Sat Jan 24 07:22:38 2009 +0300 @@ -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; }