Received: by 10.223.185.116 with SMTP id b49csp6399821wrg; Wed, 28 Feb 2018 08:47:09 -0800 (PST) X-Google-Smtp-Source: AG47ELuqWB/rFxT1o+6IWI53AHRr9KCprJWHOLg25XjbpXScXVSdZzM5gqFe+reXLZiXrCFA6oh9 X-Received: by 10.98.133.86 with SMTP id u83mr8632314pfd.172.1519836429319; Wed, 28 Feb 2018 08:47:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519836429; cv=none; d=google.com; s=arc-20160816; b=KLBaA4GEUlFvKeS3JIvpZFLNzhm6fChJIqXq9etL7c8OmMTR+KgpWSecPwrC8yMQ/e SgzmWku+kW8CH/HnTmE6rS68Xxn88XA+4F4/WUzupdSyAHUFh4NIM0rEJOZuuToirgNL gBN1Zr6DQzaYnNIx8osDtbjsOeJK2q6lEIz3as0jBEJDZuMI2+ZZWh6vIZs6cg5TK2GU Y4BDhfjg9SETp8Tn/Le7yM8y15tW4Qg2GW/SuEv31qecRrOLQhO+mHYG9Gx6SprRPaGW rv4o8RstE/usNnOKuQjv+tniEGIMyEvIVVdmFC1uIEqeK6VpArxFXX200bdVXOqWv79L sLoA== 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=fNGbvGRP1LSmkLhxQLvF2B5D/7pHsH7xUj7AII+aHgs=; b=gnBt0NSnZITQ/R+j8/L6JDI2t9FSVRnxObH1nd3zZpsagNIYFG74okvidqozqLqZc+ CiyCvDM7asKfVIB+lLFM1d64/9aT8R1vWfd7F9/sBOl2iZRwQypG7ljAqXUFKXUsHGwR 5Z7FQclNzd6Dx6JgRVtWkElQZiJFYNyNVK5gK+l15h0fu4Ox996RFxLN3pSFLAvyH3Im Oh1HWG7YRDF4C4ZmN9lLLcUXhO7R6fjqNY4ecOXWuZvjuYr4GZlTrDAkCZxQ8nQIVDV/ SMOssKbYYMfosFYy41WEkcsaoGRBCqutGdoEtqB9FycmY/Jbop98EoEWZEaLJmmcO3S6 Z6MA== 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 s12si1205469pgq.491.2018.02.28.08.46.54; Wed, 28 Feb 2018 08:47:09 -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 S1753161AbeB1QCj (ORCPT + 99 others); Wed, 28 Feb 2018 11:02:39 -0500 Received: from shadbolt.e.decadent.org.uk ([88.96.1.126]:34718 "EHLO shadbolt.e.decadent.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752967AbeB1QCg (ORCPT ); Wed, 28 Feb 2018 11:02:36 -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 1er3Yu-0006kw-2u; Wed, 28 Feb 2018 15:22:32 +0000 Received: from ben by deadeye with local (Exim 4.90_1) (envelope-from ) id 1er3Ye-0008Rg-OV; Wed, 28 Feb 2018 15:22:16 +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, "Nick Desaulniers" , "Takashi Iwai" , "Robb Glasser" Date: Wed, 28 Feb 2018 15:20:18 +0000 Message-ID: X-Mailer: LinuxStableQueue (scripts by bwh) Subject: [PATCH 3.16 058/254] ALSA: pcm: prevent UAF in snd_pcm_info 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.16.55-rc1 review patch. If anyone has any objections, please let me know. ------------------ From: Robb Glasser commit 362bca57f5d78220f8b5907b875961af9436e229 upstream. When the device descriptor is closed, the `substream->runtime` pointer is freed. But another thread may be in the ioctl handler, case SNDRV_CTL_IOCTL_PCM_INFO. This case calls snd_pcm_info_user() which calls snd_pcm_info() which accesses the now freed `substream->runtime`. Note: this fixes CVE-2017-0861 Signed-off-by: Robb Glasser Signed-off-by: Nick Desaulniers Signed-off-by: Takashi Iwai Signed-off-by: Ben Hutchings --- sound/core/pcm.c | 2 ++ 1 file changed, 2 insertions(+) --- a/sound/core/pcm.c +++ b/sound/core/pcm.c @@ -150,7 +150,9 @@ static int snd_pcm_control_ioctl(struct err = -ENXIO; goto _error; } + mutex_lock(&pcm->open_mutex); err = snd_pcm_info_user(substream, info); + mutex_unlock(&pcm->open_mutex); _error: mutex_unlock(®ister_mutex); return err;