All of lore.kernel.org
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: kbuild-all@lists.01.org
Subject: Re: [linux-next:pending-fixes 241/297] sound/core/oss/mixer_oss.c:300:1-11: second lock on line 316 (fwd)
Date: Tue, 26 Oct 2021 08:27:09 +0200	[thread overview]
Message-ID: <s5hfssoxpvm.wl-tiwai@suse.de> (raw)
In-Reply-To: <alpine.DEB.2.22.394.2110241854060.2997@hadrien>

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

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(a)lists.01.org
> Cc: lkp(a)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(a)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(a)lists.01.org
> [2  <application/gzip; US-ASCII (base64)>]
> 

WARNING: multiple messages have this Message-ID (diff)
From: Takashi Iwai <tiwai@suse.de>
To: Julia Lawall <julia.lawall@inria.fr>
Cc: Jaroslav Kysela <perex@perex.cz>,
	kbuild-all@lists.01.org,
	Linux Memory Management List <linux-mm@kvack.org>
Subject: Re: [linux-next:pending-fixes 241/297] sound/core/oss/mixer_oss.c:300:1-11: second lock on line 316 (fwd)
Date: Tue, 26 Oct 2021 08:27:09 +0200	[thread overview]
Message-ID: <s5hfssoxpvm.wl-tiwai@suse.de> (raw)
In-Reply-To: <alpine.DEB.2.22.394.2110241854060.2997@hadrien>

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)>]
> 


  reply	other threads:[~2021-10-26  6:27 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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-24 16:54 ` Julia Lawall
2021-10-26  6:27 ` Takashi Iwai [this message]
2021-10-26  6:27   ` Takashi Iwai

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=s5hfssoxpvm.wl-tiwai@suse.de \
    --to=tiwai@suse.de \
    --cc=kbuild-all@lists.01.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.