linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [linux-next:pending-fixes 241/297] sound/core/oss/mixer_oss.c:300:1-11: second lock on line 316 (fwd)
@ 2021-10-24 16:54 Julia Lawall
  2021-10-26  6:27 ` Takashi Iwai
  0 siblings, 1 reply; 2+ messages in thread
From: Julia Lawall @ 2021-10-24 16:54 UTC (permalink / raw)
  To: Takashi Iwai, Jaroslav Kysela; +Cc: kbuild-all, Linux Memory Management List

[-- Attachment #1: Type: text/plain, Size: 3460 bytes --]

Line 316 needs to be an unlock.

julia

---------- Forwarded message ----------
Date: Sun, 24 Oct 2021 22:51:40 +0800
From: kernel test robot <lkp@intel.com>
To: kbuild@lists.01.org
Cc: lkp@intel.com, Julia Lawall <julia.lawall@lip6.fr>
Subject: [linux-next:pending-fixes 241/297] sound/core/oss/mixer_oss.c:300:1-11:
     second lock on line 316

CC: kbuild-all@lists.01.org
CC: Linux Memory Management List <linux-mm@kvack.org>
TO: Takashi Iwai <tiwai@suse.de>
CC: Jaroslav Kysela <perex@perex.cz>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git pending-fixes
head:   9344874edebc5f4360a045cdef5e4ab3cf42e5bd
commit: 411cef6adfb38a5bb6bd9af3941b28198e7fb680 [241/297] ALSA: mixer: oss: Fix racy access to slots
:::::: branch date: 3 days ago
:::::: commit date: 3 days ago
config: arm-allyesconfig (attached as .config)
compiler: arm-linux-gnueabi-gcc (GCC) 11.2.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Julia Lawall <julia.lawall@lip6.fr>


cocci warnings: (new ones prefixed by >>)
>> sound/core/oss/mixer_oss.c:300:1-11: second lock on line 316

vim +300 sound/core/oss/mixer_oss.c

^1da177e4c3f41 Linus Torvalds 2005-04-16  290
f956b4a3ae790e Takashi Iwai   2005-11-17  291  static int snd_mixer_oss_set_volume(struct snd_mixer_oss_file *fmixer,
^1da177e4c3f41 Linus Torvalds 2005-04-16  292  				    int slot, int volume)
^1da177e4c3f41 Linus Torvalds 2005-04-16  293  {
f956b4a3ae790e Takashi Iwai   2005-11-17  294  	struct snd_mixer_oss *mixer = fmixer->mixer;
f956b4a3ae790e Takashi Iwai   2005-11-17  295  	struct snd_mixer_oss_slot *pslot;
^1da177e4c3f41 Linus Torvalds 2005-04-16  296  	int result = 0, left = volume & 0xff, right = (volume >> 8) & 0xff;
^1da177e4c3f41 Linus Torvalds 2005-04-16  297
^1da177e4c3f41 Linus Torvalds 2005-04-16  298  	if (mixer == NULL || slot > 30)
^1da177e4c3f41 Linus Torvalds 2005-04-16  299  		return -EIO;
411cef6adfb38a Takashi Iwai   2021-10-20 @300  	mutex_lock(&mixer->reg_mutex);
^1da177e4c3f41 Linus Torvalds 2005-04-16  301  	pslot = &mixer->slots[slot];
^1da177e4c3f41 Linus Torvalds 2005-04-16  302  	if (left > 100)
^1da177e4c3f41 Linus Torvalds 2005-04-16  303  		left = 100;
^1da177e4c3f41 Linus Torvalds 2005-04-16  304  	if (right > 100)
^1da177e4c3f41 Linus Torvalds 2005-04-16  305  		right = 100;
^1da177e4c3f41 Linus Torvalds 2005-04-16  306  	if (!pslot->stereo)
^1da177e4c3f41 Linus Torvalds 2005-04-16  307  		right = left;
^1da177e4c3f41 Linus Torvalds 2005-04-16  308  	if (pslot->put_volume)
^1da177e4c3f41 Linus Torvalds 2005-04-16  309  		result = pslot->put_volume(fmixer, pslot, left, right);
^1da177e4c3f41 Linus Torvalds 2005-04-16  310  	if (result < 0)
411cef6adfb38a Takashi Iwai   2021-10-20  311  		goto unlock;
^1da177e4c3f41 Linus Torvalds 2005-04-16  312  	pslot->volume[0] = left;
^1da177e4c3f41 Linus Torvalds 2005-04-16  313  	pslot->volume[1] = right;
411cef6adfb38a Takashi Iwai   2021-10-20  314  	result = (left & 0xff) | ((right & 0xff) << 8);
411cef6adfb38a Takashi Iwai   2021-10-20  315   unlock:
411cef6adfb38a Takashi Iwai   2021-10-20 @316  	mutex_lock(&mixer->reg_mutex);
411cef6adfb38a Takashi Iwai   2021-10-20  317  	return result;
^1da177e4c3f41 Linus Torvalds 2005-04-16  318  }
^1da177e4c3f41 Linus Torvalds 2005-04-16  319

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

[-- Attachment #2: Type: application/gzip, Size: 79206 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [linux-next:pending-fixes 241/297] sound/core/oss/mixer_oss.c:300:1-11: second lock on line 316 (fwd)
  2021-10-24 16:54 [linux-next:pending-fixes 241/297] sound/core/oss/mixer_oss.c:300:1-11: second lock on line 316 (fwd) Julia Lawall
@ 2021-10-26  6:27 ` Takashi Iwai
  0 siblings, 0 replies; 2+ messages in thread
From: Takashi Iwai @ 2021-10-26  6:27 UTC (permalink / raw)
  To: Julia Lawall; +Cc: Jaroslav Kysela, kbuild-all, Linux Memory Management List

On Sun, 24 Oct 2021 18:54:52 +0200,
Julia Lawall wrote:
> 
> Line 316 needs to be an unlock.

Right, the fix is already queued.


thanks,

Takashi

> 
> julia
> 
> ---------- Forwarded message ----------
> Date: Sun, 24 Oct 2021 22:51:40 +0800
> From: kernel test robot <lkp@intel.com>
> To: kbuild@lists.01.org
> Cc: lkp@intel.com, Julia Lawall <julia.lawall@lip6.fr>
> Subject: [linux-next:pending-fixes 241/297] sound/core/oss/mixer_oss.c:300:1-11:
>      second lock on line 316
> 
> CC: kbuild-all@lists.01.org
> CC: Linux Memory Management List <linux-mm@kvack.org>
> TO: Takashi Iwai <tiwai@suse.de>
> CC: Jaroslav Kysela <perex@perex.cz>
> 
> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git pending-fixes
> head:   9344874edebc5f4360a045cdef5e4ab3cf42e5bd
> commit: 411cef6adfb38a5bb6bd9af3941b28198e7fb680 [241/297] ALSA: mixer: oss: Fix racy access to slots
> :::::: branch date: 3 days ago
> :::::: commit date: 3 days ago
> config: arm-allyesconfig (attached as .config)
> compiler: arm-linux-gnueabi-gcc (GCC) 11.2.0
> 
> If you fix the issue, kindly add following tag as appropriate
> Reported-by: kernel test robot <lkp@intel.com>
> Reported-by: Julia Lawall <julia.lawall@lip6.fr>
> 
> 
> cocci warnings: (new ones prefixed by >>)
> >> sound/core/oss/mixer_oss.c:300:1-11: second lock on line 316
> 
> vim +300 sound/core/oss/mixer_oss.c
> 
> ^1da177e4c3f41 Linus Torvalds 2005-04-16  290
> f956b4a3ae790e Takashi Iwai   2005-11-17  291  static int snd_mixer_oss_set_volume(struct snd_mixer_oss_file *fmixer,
> ^1da177e4c3f41 Linus Torvalds 2005-04-16  292  				    int slot, int volume)
> ^1da177e4c3f41 Linus Torvalds 2005-04-16  293  {
> f956b4a3ae790e Takashi Iwai   2005-11-17  294  	struct snd_mixer_oss *mixer = fmixer->mixer;
> f956b4a3ae790e Takashi Iwai   2005-11-17  295  	struct snd_mixer_oss_slot *pslot;
> ^1da177e4c3f41 Linus Torvalds 2005-04-16  296  	int result = 0, left = volume & 0xff, right = (volume >> 8) & 0xff;
> ^1da177e4c3f41 Linus Torvalds 2005-04-16  297
> ^1da177e4c3f41 Linus Torvalds 2005-04-16  298  	if (mixer == NULL || slot > 30)
> ^1da177e4c3f41 Linus Torvalds 2005-04-16  299  		return -EIO;
> 411cef6adfb38a Takashi Iwai   2021-10-20 @300  	mutex_lock(&mixer->reg_mutex);
> ^1da177e4c3f41 Linus Torvalds 2005-04-16  301  	pslot = &mixer->slots[slot];
> ^1da177e4c3f41 Linus Torvalds 2005-04-16  302  	if (left > 100)
> ^1da177e4c3f41 Linus Torvalds 2005-04-16  303  		left = 100;
> ^1da177e4c3f41 Linus Torvalds 2005-04-16  304  	if (right > 100)
> ^1da177e4c3f41 Linus Torvalds 2005-04-16  305  		right = 100;
> ^1da177e4c3f41 Linus Torvalds 2005-04-16  306  	if (!pslot->stereo)
> ^1da177e4c3f41 Linus Torvalds 2005-04-16  307  		right = left;
> ^1da177e4c3f41 Linus Torvalds 2005-04-16  308  	if (pslot->put_volume)
> ^1da177e4c3f41 Linus Torvalds 2005-04-16  309  		result = pslot->put_volume(fmixer, pslot, left, right);
> ^1da177e4c3f41 Linus Torvalds 2005-04-16  310  	if (result < 0)
> 411cef6adfb38a Takashi Iwai   2021-10-20  311  		goto unlock;
> ^1da177e4c3f41 Linus Torvalds 2005-04-16  312  	pslot->volume[0] = left;
> ^1da177e4c3f41 Linus Torvalds 2005-04-16  313  	pslot->volume[1] = right;
> 411cef6adfb38a Takashi Iwai   2021-10-20  314  	result = (left & 0xff) | ((right & 0xff) << 8);
> 411cef6adfb38a Takashi Iwai   2021-10-20  315   unlock:
> 411cef6adfb38a Takashi Iwai   2021-10-20 @316  	mutex_lock(&mixer->reg_mutex);
> 411cef6adfb38a Takashi Iwai   2021-10-20  317  	return result;
> ^1da177e4c3f41 Linus Torvalds 2005-04-16  318  }
> ^1da177e4c3f41 Linus Torvalds 2005-04-16  319
> 
> ---
> 0-DAY CI Kernel Test Service, Intel Corporation
> https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
> [2  <application/gzip; US-ASCII (base64)>]
> 


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-10-26  6:27 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-24 16:54 [linux-next:pending-fixes 241/297] sound/core/oss/mixer_oss.c:300:1-11: second lock on line 316 (fwd) Julia Lawall
2021-10-26  6:27 ` Takashi Iwai

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).