[linux-next:pending-fixes 241/297] sound/core/oss/mixer_oss.c:300:1-11: second lock on line 316 (fwd)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Line 316 needs to be an unlock.

julia

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

CC: kbuild-all@xxxxxxxxxxxx
CC: Linux Memory Management List <linux-mm@xxxxxxxxx>
TO: Takashi Iwai <tiwai@xxxxxxx>
CC: Jaroslav Kysela <perex@xxxxxxxx>

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@xxxxxxxxx>
Reported-by: Julia Lawall <julia.lawall@xxxxxxx>


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@xxxxxxxxxxxx

Attachment: .config.gz
Description: application/gzip


[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux