Received: by 10.223.185.116 with SMTP id b49csp821592wrg; Sat, 10 Feb 2018 21:10:55 -0800 (PST) X-Google-Smtp-Source: AH8x226b0i6hyL0za8jkcA2bULZbGpQfA+Vw7nJQ1AD/rqJF3m23Cn5N+Ev496pzeJWNkok0tw1v X-Received: by 10.99.67.197 with SMTP id q188mr6217656pga.255.1518325854894; Sat, 10 Feb 2018 21:10:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518325854; cv=none; d=google.com; s=arc-20160816; b=RNA0Ip+iVUEbr6QfGFNVC28sjbWiki6d+XBlUQvXMP5tv/9KWYMffMimmuVKZt7ylS G85jpgXWmbqhkM1pP1C90waI5qnv6Y0/AZh4e+Jq7QaORuJzELgsHaH4yo2pXNeuPCH1 9EIDI12EUDWDP1KqBpiBy9FRudSrlvD+LxKQQCnSwto/kVABsqCDqLlEuxpvAoPV8xcl gORzVhJq3+L+AV8tqZhPiRDAqZkg/eUeuVCaXz4POmQT6dPcaGOEiUecczIbXKfUKAO2 aRMI7YMboyISm+Hsl1lLdQGnyMetM/RmV6dWnJKdzI27hVY5/k2BLcSYcBSqcH4Jv6qm JN1w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:subject:message-id:date:cc:to :from:mime-version:content-transfer-encoding:content-disposition :arc-authentication-results; bh=3TjjdGoyLgzRNfR5VcoBIY7Vlplbn1L1HN9vYG4XL6U=; b=TxcoJXZJE/tmSyfsLYuTcNOkLr179y5gOHgWcBZa3ff5dCK9UxlHfQPXGddYJsZShx CYn0aH9MpZUTqCtxVx8fjCD3hvztTBVE4GyStpnLcJGaVWx8fJgHYR8OkF/L+hXSEj1F b2U9emAXGBU7Nn9gunP+3DJRz4cZNGEw/slMNytHaK2+MakFJudxjHBKONeMBHLjOBPs scZ+iSUb+d0lMFRM7qcJiLNy5+aUrHWUFt5dfpKEHG+R54LZK7zOD0xdPAO2K2X3B4Tx jCl4n/TQwhYZRS6O7+MxckoUempN/QOzhGrQn1MyCtbVIUSdX8SmWjFiBy1jnPImSfF6 Za9Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d9-v6si3310964pln.115.2018.02.10.21.10.41; Sat, 10 Feb 2018 21:10:54 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753972AbeBKFJd (ORCPT + 99 others); Sun, 11 Feb 2018 00:09:33 -0500 Received: from shadbolt.e.decadent.org.uk ([88.96.1.126]:41453 "EHLO shadbolt.e.decadent.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752649AbeBKEdm (ORCPT ); Sat, 10 Feb 2018 23:33:42 -0500 Received: from [2a02:8011:400e:2:6f00:88c8:c921:d332] (helo=deadeye) by shadbolt.decadent.org.uk with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1ekjKd-0002hH-Qw; Sun, 11 Feb 2018 04:33:39 +0000 Received: from ben by deadeye with local (Exim 4.90) (envelope-from ) id 1ekjKY-0004Vm-Ei; Sun, 11 Feb 2018 04:33:34 +0000 Content-Type: text/plain; charset="UTF-8" Content-Disposition: inline Content-Transfer-Encoding: 8bit MIME-Version: 1.0 From: Ben Hutchings To: linux-kernel@vger.kernel.org, stable@vger.kernel.org CC: akpm@linux-foundation.org, "syzbot" , "Takashi Iwai" Date: Sun, 11 Feb 2018 04:20:06 +0000 Message-ID: X-Mailer: LinuxStableQueue (scripts by bwh) Subject: [PATCH 3.2 54/79] ALSA: timer: Remove kernel warning at compat ioctl error paths In-Reply-To: X-SA-Exim-Connect-IP: 2a02:8011:400e:2:6f00:88c8:c921:d332 X-SA-Exim-Mail-From: ben@decadent.org.uk X-SA-Exim-Scanned: No (on shadbolt.decadent.org.uk); SAEximRunCond expanded to false Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 3.2.99-rc1 review patch. If anyone has any objections, please let me know. ------------------ From: Takashi Iwai commit 3d4e8303f2c747c8540a0a0126d0151514f6468b upstream. Some timer compat ioctls have NULL checks of timer instance with snd_BUG_ON() that bring up WARN_ON() when the debug option is set. Actually the condition can be met in the normal situation and it's confusing and bad to spew kernel warnings with stack trace there. Let's remove snd_BUG_ON() invocation and replace with the simple checks. Also, correct the error code to EBADFD to follow the native ioctl error handling. Reported-by: syzbot Signed-off-by: Takashi Iwai Signed-off-by: Ben Hutchings --- sound/core/timer_compat.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) --- a/sound/core/timer_compat.c +++ b/sound/core/timer_compat.c @@ -40,11 +40,11 @@ static int snd_timer_user_info_compat(st struct snd_timer *t; tu = file->private_data; - if (snd_BUG_ON(!tu->timeri)) - return -ENXIO; + if (!tu->timeri) + return -EBADFD; t = tu->timeri->timer; - if (snd_BUG_ON(!t)) - return -ENXIO; + if (!t) + return -EBADFD; memset(&info, 0, sizeof(info)); info.card = t->card ? t->card->number : -1; if (t->hw.flags & SNDRV_TIMER_HW_SLAVE) @@ -73,8 +73,8 @@ static int snd_timer_user_status_compat( struct snd_timer_status32 status; tu = file->private_data; - if (snd_BUG_ON(!tu->timeri)) - return -ENXIO; + if (!tu->timeri) + return -EBADFD; memset(&status, 0, sizeof(status)); status.tstamp.tv_sec = tu->tstamp.tv_sec; status.tstamp.tv_nsec = tu->tstamp.tv_nsec;