From patchwork Wed Oct 12 06:21:40 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Carpenter X-Patchwork-Id: 9372131 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id D5DDE60772 for ; Wed, 12 Oct 2016 06:24:31 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C27B529BA2 for ; Wed, 12 Oct 2016 06:24:31 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B513329BB3; Wed, 12 Oct 2016 06:24:31 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D857F29BA2 for ; Wed, 12 Oct 2016 06:24:30 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id EF5B6266A53; Wed, 12 Oct 2016 08:24:28 +0200 (CEST) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 32A6E2614A0; Wed, 12 Oct 2016 08:22:12 +0200 (CEST) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id 00E06266A39; Wed, 12 Oct 2016 08:22:02 +0200 (CEST) Received: from userp1040.oracle.com (userp1040.oracle.com [156.151.31.81]) by alsa0.perex.cz (Postfix) with ESMTP id B3A2C2614A0 for ; Wed, 12 Oct 2016 08:22:00 +0200 (CEST) Received: from userv0022.oracle.com (userv0022.oracle.com [156.151.31.74]) by userp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id u9C6Lvr1024111 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 12 Oct 2016 06:21:57 GMT Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by userv0022.oracle.com (8.14.4/8.14.4) with ESMTP id u9C6Ltia017983 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 12 Oct 2016 06:21:55 GMT Received: from abhmp0019.oracle.com (abhmp0019.oracle.com [141.146.116.25]) by userv0121.oracle.com (8.13.8/8.13.8) with ESMTP id u9C6LoFu012900; Wed, 12 Oct 2016 06:21:52 GMT Received: from mwanda (/154.122.16.210) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 11 Oct 2016 23:21:50 -0700 Date: Wed, 12 Oct 2016 09:21:40 +0300 From: Dan Carpenter To: Jaroslav Kysela , Andrej Krutak Message-ID: <20161012062140.GT12841@mwanda> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.6.0 (2016-04-01) X-Source-IP: userv0022.oracle.com [156.151.31.74] Cc: alsa-devel@alsa-project.org, kbuild test robot , kernel-janitors@vger.kernel.org, Takashi Iwai , Takashi Sakamoto Subject: [alsa-devel] [patch] ALSA: line6: fix a crash in line6_hwdep_write() X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP The error checking here is messed up so we could end up dereferencing -EFAULT. Fixes: a16039cbf1a1 ('ALSA: line6: Add hwdep interface to access the POD control messages') Signed-off-by: Dan Carpenter Reviewed-by: Takashi Sakamoto diff --git a/sound/usb/line6/driver.c b/sound/usb/line6/driver.c index 14e587e..90009c0 100644 --- a/sound/usb/line6/driver.c +++ b/sound/usb/line6/driver.c @@ -604,8 +604,8 @@ line6_hwdep_write(struct snd_hwdep *hwdep, const char __user *data, long count, } data_copy = memdup_user(data, count); - if (IS_ERR(ERR_PTR)) - return -ENOMEM; + if (IS_ERR(data_copy)) + return PTR_ERR(data_copy); rv = line6_send_raw_message(line6, data_copy, count);