stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: linux-kernel@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	stable@vger.kernel.org, Zhouyang Jia <jiazhouyang09@gmail.com>,
	Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
	Takashi Iwai <tiwai@suse.de>,
	Sasha Levin <alexander.levin@microsoft.com>
Subject: [PATCH 3.18 06/85] ALSA: fm801: add error handling for snd_ctl_add
Date: Tue,  7 Aug 2018 20:51:08 +0200	[thread overview]
Message-ID: <20180807172357.591294207@linuxfoundation.org> (raw)
In-Reply-To: <20180807172357.357252052@linuxfoundation.org>

3.18-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Zhouyang Jia <jiazhouyang09@gmail.com>

[ Upstream commit ef1ffbe7889e99f5b5cccb41c89e5c94f50f3218 ]

When snd_ctl_add fails, the lack of error-handling code may
cause unexpected results.

This patch adds error-handling code after calling snd_ctl_add.

Signed-off-by: Zhouyang Jia <jiazhouyang09@gmail.com>
Acked-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 sound/pci/fm801.c |   16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

--- a/sound/pci/fm801.c
+++ b/sound/pci/fm801.c
@@ -1070,11 +1070,19 @@ static int snd_fm801_mixer(struct fm801
 		if ((err = snd_ac97_mixer(chip->ac97_bus, &ac97, &chip->ac97_sec)) < 0)
 			return err;
 	}
-	for (i = 0; i < FM801_CONTROLS; i++)
-		snd_ctl_add(chip->card, snd_ctl_new1(&snd_fm801_controls[i], chip));
+	for (i = 0; i < FM801_CONTROLS; i++) {
+		err = snd_ctl_add(chip->card,
+			snd_ctl_new1(&snd_fm801_controls[i], chip));
+		if (err < 0)
+			return err;
+	}
 	if (chip->multichannel) {
-		for (i = 0; i < FM801_CONTROLS_MULTI; i++)
-			snd_ctl_add(chip->card, snd_ctl_new1(&snd_fm801_controls_multi[i], chip));
+		for (i = 0; i < FM801_CONTROLS_MULTI; i++) {
+			err = snd_ctl_add(chip->card,
+				snd_ctl_new1(&snd_fm801_controls_multi[i], chip));
+			if (err < 0)
+				return err;
+		}
 	}
 	return 0;
 }

  parent reply	other threads:[~2018-08-07 21:13 UTC|newest]

Thread overview: 85+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-07 18:51 [PATCH 3.18 00/85] 3.18.118-stable review Greg Kroah-Hartman
2018-08-07 18:51 ` [PATCH 3.18 01/85] tracing: Fix double free of event_trigger_data Greg Kroah-Hartman
2018-08-07 18:51 ` [PATCH 3.18 02/85] tracing: Fix possible double free in event_enable_trigger_func() Greg Kroah-Hartman
2018-08-07 18:51 ` [PATCH 3.18 03/85] tracing/kprobes: Fix trace_probe flags on enable_trace_kprobe() failure Greg Kroah-Hartman
2018-08-07 18:51 ` [PATCH 3.18 04/85] tracing: Quiet gcc warning about maybe unused link variable Greg Kroah-Hartman
2018-08-07 18:51 ` [PATCH 3.18 05/85] ALSA: emu10k1: add error handling for snd_ctl_add Greg Kroah-Hartman
2018-08-07 18:51 ` Greg Kroah-Hartman [this message]
2018-08-07 18:51 ` [PATCH 3.18 07/85] mm: vmalloc: avoid racy handling of debugobjects in vunmap Greg Kroah-Hartman
2018-08-07 18:51 ` [PATCH 3.18 08/85] mm/slub.c: add __printf verification to slab_err() Greg Kroah-Hartman
2018-08-07 18:51 ` [PATCH 3.18 09/85] rtc: ensure rtc_set_alarm fails when alarms are not supported Greg Kroah-Hartman
2018-08-07 18:51 ` [PATCH 3.18 10/85] infiniband: fix a possible use-after-free bug Greg Kroah-Hartman
2018-08-07 18:51 ` [PATCH 3.18 11/85] hvc_opal: dont set tb_ticks_per_usec in udbg_init_opal_common() Greg Kroah-Hartman
2018-08-07 18:51 ` [PATCH 3.18 12/85] RDMA/mad: Convert BUG_ONs to error flows Greg Kroah-Hartman
2018-08-07 18:51 ` [PATCH 3.18 13/85] usbip: usbip_detach: Fix memory, udev context and udev leak Greg Kroah-Hartman
2018-08-07 18:51 ` [PATCH 3.18 14/85] perf/x86/intel/uncore: Correct fixed counter index check in generic code Greg Kroah-Hartman
2018-08-07 18:51 ` [PATCH 3.18 15/85] perf/x86/intel/uncore: Correct fixed counter index check for NHM Greg Kroah-Hartman
2018-08-07 18:51 ` [PATCH 3.18 16/85] ASoC: dpcm: fix BE dai not hw_free and shutdown Greg Kroah-Hartman
2018-08-07 18:51 ` [PATCH 3.18 17/85] mwifiex: handle race during mwifiex_usb_disconnect Greg Kroah-Hartman
2018-08-07 18:51 ` [PATCH 3.18 18/85] wlcore: sdio: check for valid platform device data before suspend Greg Kroah-Hartman
2018-08-07 18:51 ` [PATCH 3.18 19/85] PCI: Prevent sysfs disable of device while driver is attached Greg Kroah-Hartman
2018-08-07 18:51 ` [PATCH 3.18 20/85] ath: Add regulatory mapping for FCC3_ETSIC Greg Kroah-Hartman
2018-08-07 18:51 ` [PATCH 3.18 21/85] ath: Add regulatory mapping for ETSI8_WORLD Greg Kroah-Hartman
2018-08-07 18:51 ` [PATCH 3.18 22/85] ath: Add regulatory mapping for APL13_WORLD Greg Kroah-Hartman
2018-08-07 18:51 ` [PATCH 3.18 23/85] ath: Add regulatory mapping for APL2_FCCA Greg Kroah-Hartman
2018-08-07 18:51 ` [PATCH 3.18 24/85] ath: Add regulatory mapping for Uganda Greg Kroah-Hartman
2018-08-07 18:51 ` [PATCH 3.18 25/85] ath: Add regulatory mapping for Tanzania Greg Kroah-Hartman
2018-08-07 18:51 ` [PATCH 3.18 26/85] ath: Add regulatory mapping for Serbia Greg Kroah-Hartman
2018-08-07 18:51 ` [PATCH 3.18 27/85] ath: Add regulatory mapping for Bermuda Greg Kroah-Hartman
2018-08-07 18:51 ` [PATCH 3.18 28/85] ath: Add regulatory mapping for Bahamas Greg Kroah-Hartman
2018-08-07 18:51 ` [PATCH 3.18 33/85] powerpc/8xx: fix invalid register expression in head_8xx.S Greg Kroah-Hartman
2018-08-07 18:51 ` [PATCH 3.18 34/85] PCI: pciehp: Request control of native hotplug only if supported Greg Kroah-Hartman
2018-08-07 18:51 ` [PATCH 3.18 35/85] scsi: ufs: fix exception event handling Greg Kroah-Hartman
2018-08-07 18:51 ` [PATCH 3.18 36/85] ALSA: emu10k1: Rate-limit error messages about page errors Greg Kroah-Hartman
2018-08-07 18:51 ` [PATCH 3.18 37/85] regulator: pfuze100: add .is_enable() for pfuze100_swb_regulator_ops Greg Kroah-Hartman
2018-08-07 18:51 ` [PATCH 3.18 38/85] md: fix NULL dereference of mddev->pers in remove_and_add_spares() Greg Kroah-Hartman
2018-08-07 18:51 ` [PATCH 3.18 39/85] media: smiapp: fix timeout checking in smiapp_read_nvm Greg Kroah-Hartman
2018-08-07 18:51 ` [PATCH 3.18 40/85] ALSA: usb-audio: Apply rate limit to warning messages in URB complete callback Greg Kroah-Hartman
2018-08-07 18:51 ` [PATCH 3.18 41/85] drm/radeon: fix mode_valids return type Greg Kroah-Hartman
2018-08-07 18:51 ` [PATCH 3.18 43/85] HID: i2c-hid: check if device is there before really probing Greg Kroah-Hartman
2018-08-07 18:51 ` [PATCH 3.18 44/85] tty: Fix data race in tty_insert_flip_string_fixed_flag Greg Kroah-Hartman
2018-08-07 18:51 ` [PATCH 3.18 45/85] libata: Fix command retry decision Greg Kroah-Hartman
2018-08-07 18:51 ` [PATCH 3.18 46/85] media: saa7164: Fix driver name in debug output Greg Kroah-Hartman
2018-08-07 18:51 ` [PATCH 3.18 47/85] s390/cpum_sf: Add data entry sizes to sampling trailer entry Greg Kroah-Hartman
2018-08-07 18:51 ` [PATCH 3.18 48/85] perf: fix invalid bit in diagnostic entry Greg Kroah-Hartman
2018-08-07 18:51 ` [PATCH 3.18 49/85] scsi: 3w-9xxx: fix a missing-check bug Greg Kroah-Hartman
2018-08-07 18:51 ` [PATCH 3.18 50/85] scsi: 3w-xxxx: " Greg Kroah-Hartman
2018-08-07 18:51 ` [PATCH 3.18 51/85] scsi: megaraid: silence a static checker bug Greg Kroah-Hartman
2018-08-07 18:51 ` [PATCH 3.18 52/85] bpf: fix references to free_bpf_prog_info() in comments Greg Kroah-Hartman
2018-08-07 18:51 ` [PATCH 3.18 53/85] media: siano: get rid of __le32/__le16 cast warnings Greg Kroah-Hartman
2018-08-07 18:51 ` [PATCH 3.18 54/85] ALSA: hda/ca0132: fix build failure when a local macro is defined Greg Kroah-Hartman
2018-08-07 18:51 ` [PATCH 3.18 55/85] drm/gma500: fix psb_intel_lvds_mode_valid()s return type Greg Kroah-Hartman
2018-08-07 18:51 ` [PATCH 3.18 56/85] ipconfig: Correctly initialise ic_nameservers Greg Kroah-Hartman
2018-08-07 18:51 ` [PATCH 3.18 57/85] rsi: Fix invalid vdd warning in mmc Greg Kroah-Hartman
2018-08-07 18:52 ` [PATCH 3.18 58/85] microblaze: Fix simpleImage format generation Greg Kroah-Hartman
2018-08-07 18:52 ` [PATCH 3.18 59/85] usb: hub: Dont wait for connect state at resume for powered-off ports Greg Kroah-Hartman
2018-08-07 18:52 ` [PATCH 3.18 60/85] crypto: authencesn - dont leak pointers to authenc keys Greg Kroah-Hartman
2018-08-07 18:52 ` [PATCH 3.18 61/85] crypto: authenc " Greg Kroah-Hartman
2018-08-07 18:52 ` [PATCH 3.18 62/85] media: omap3isp: fix unbalanced dma_iommu_mapping Greg Kroah-Hartman
2018-08-07 18:52 ` [PATCH 3.18 63/85] media: si470x: fix __be16 annotations Greg Kroah-Hartman
2018-08-07 18:52 ` [PATCH 3.18 64/85] random: mix rdrand with entropy sent in from userspace Greg Kroah-Hartman
2018-08-07 18:52 ` [PATCH 3.18 65/85] squashfs: be more careful about metadata corruption Greg Kroah-Hartman
2018-08-07 18:52 ` [PATCH 3.18 66/85] NET: stmmac: align DMA stuff to largest cache line length Greg Kroah-Hartman
2018-08-07 18:52 ` [PATCH 3.18 67/85] xen-netfront: wait xenbus state change when load module manually Greg Kroah-Hartman
2018-08-07 18:52 ` [PATCH 3.18 68/85] tcp: do not force quickack when receiving out-of-order packets Greg Kroah-Hartman
2018-08-07 18:52 ` [PATCH 3.18 69/85] tcp: add max_quickacks param to tcp_incr_quickack and tcp_enter_quickack_mode Greg Kroah-Hartman
2018-08-07 18:52 ` [PATCH 3.18 70/85] tcp: do not aggressively quick ack after ECN events Greg Kroah-Hartman
2018-08-07 18:52 ` [PATCH 3.18 71/85] tcp: refactor tcp_ecn_check_ce to remove sk type cast Greg Kroah-Hartman
2018-08-07 18:52 ` [PATCH 3.18 72/85] tcp: add one more quick ack after after ECN events Greg Kroah-Hartman
2018-08-07 18:52 ` [PATCH 3.18 73/85] ipv4: remove BUG_ON() from fib_compute_spec_dst Greg Kroah-Hartman
2018-08-07 18:52 ` [PATCH 3.18 74/85] inet: frag: enforce memory limits earlier Greg Kroah-Hartman
2018-08-07 18:52 ` [PATCH 3.18 75/85] net: dsa: Do not suspend/resume closed slave_dev Greg Kroah-Hartman
2018-08-07 18:52 ` [PATCH 3.18 76/85] squashfs: more metadata hardening Greg Kroah-Hartman
2018-08-07 18:52 ` [PATCH 3.18 78/85] can: ems_usb: Fix memory leak on ems_usb_disconnect() Greg Kroah-Hartman
2018-08-07 18:52 ` [PATCH 3.18 79/85] virtio_balloon: fix another race between migration and ballooning Greg Kroah-Hartman
2018-08-07 18:52 ` [PATCH 3.18 80/85] crypto: padlock-aes - Fix Nano workaround data corruption Greg Kroah-Hartman
2018-08-07 18:52 ` [PATCH 3.18 81/85] scsi: sg: fix minor memory leak in error path Greg Kroah-Hartman
2018-08-07 18:52 ` [PATCH 3.18 82/85] scsi: qla2xxx: Fix ISP recovery on unload Greg Kroah-Hartman
2018-08-07 18:52 ` [PATCH 3.18 83/85] scsi: qla2xxx: Return error when TMF returns Greg Kroah-Hartman
2018-08-07 18:52 ` [PATCH 3.18 84/85] ring_buffer: tracing: Inherit the tracing setting to next ring buffer Greg Kroah-Hartman
2018-08-07 18:52 ` [PATCH 3.18 85/85] jfs: Fix inconsistency between memory allocation and ea_buf->max_size Greg Kroah-Hartman
2018-08-07 22:33 ` [PATCH 3.18 00/85] 3.18.118-stable review Nathan Chancellor
2018-08-08  6:35   ` Greg Kroah-Hartman
2018-08-08  2:52 ` Shuah Khan
2018-08-08  5:29   ` Greg Kroah-Hartman
2018-08-08 16:05 ` Guenter Roeck

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=20180807172357.591294207@linuxfoundation.org \
    --to=gregkh@linuxfoundation.org \
    --cc=alexander.levin@microsoft.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=jiazhouyang09@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=tiwai@suse.de \
    /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 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).