Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp158984pxx; Wed, 28 Oct 2020 01:04:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzZ5VtT+m0Pq00LZWYUZS0pRXHa0pFNHpAo0BmL4dg9QXhH1YynEO1UIoqaUgX7BnBQchmI X-Received: by 2002:a17:906:3cc:: with SMTP id c12mr6264871eja.216.1603872297086; Wed, 28 Oct 2020 01:04:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603872297; cv=none; d=google.com; s=arc-20160816; b=MtqsFQIonpJHXKd/DxDEnCMVWlxiwrKF/mxIaV+tOQQgV2TuFdGou1hZ607337Ff31 ycfljSkUPwPnc4TLnm6pR74sl7PHUgqQxfnZauHq73TaVDiEBV6zTAb7QYlN8yvbDgSn uNHw60Sw0WJ2aRqgPqTcgBSrIC/k8NRI1OrG9W2zpukpqKbthF9+yicPe+mQDBsN7QZD I84LrSqs0Xvko6cOb9nG53H49Ah0PFVPB00dHBqiuA/dC11aAAWOodlN/WDBmgsLgw+s Y4KNy1ddY2c3PEmcGRhLqUHrvhobewV9Doka0HwGp0hJyf5Hf/d0Qgx3SMnZXazwQmpL h9ZQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=B7JaEUJZ703rHO+/HDPvVfM0HmEBWvV5MwdVdQQzYQo=; b=hokMH92jV9CIKgN6jF3/RjAH5p88LOFknkx/DTUxhJztKeZZd+3e5ZfMDkSbDbWPH/ wKZ7Q7SyZJmYROLWq3rViIBo8A0T6gLk/vm565x/JSUnnsmOLfrl3Gg3994NNS+JPubP O6s5YeqPzGKSK7DTi8Oq/hz7mezfqxQJdlRd3FktmsVhcBPtQbfQVqCqQYEPXUDWqqi5 LjDz8NH9yCJtw594724EahksusOnva2G6jr1JCUabrqBUPy+4M8ru4mYJG4zrCKZmvUo dvzeim9PfhS/nr164vvkHz4Ys2AHxX8irPu6jjhh98vDM3bfliyhBztiMZ1sKMftffQp KA7Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=c19rx7HF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p90si2749641edd.284.2020.10.28.01.04.34; Wed, 28 Oct 2020 01:04:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=c19rx7HF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752944AbgJ0N5r (ORCPT + 99 others); Tue, 27 Oct 2020 09:57:47 -0400 Received: from mail.kernel.org ([198.145.29.99]:44642 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752912AbgJ0N5j (ORCPT ); Tue, 27 Oct 2020 09:57:39 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 1E4BA21655; Tue, 27 Oct 2020 13:57:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603807058; bh=6Ru14FfKMxajVakNntDal+Pwp6FhhFhEwqVPOngvRe8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=c19rx7HFPCVmZEqMYCTumHV/QsG6usxxASCFI2FukpqXvI4Af4FVKLvPRFlPKaI1t bAl2ijmHM2M8oB8Dv96AVpR16pn3CXnWBcxzcGwLRWkouTw8T9oYsMxNTJWP++XbFR Y9Lw82+igPlLT8zrTUKcwNnLzT5AE1K/q8yq+VSM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Carpenter , Takashi Sakamoto , Takashi Iwai Subject: [PATCH 4.4 005/112] ALSA: bebob: potential info leak in hwdep_read() Date: Tue, 27 Oct 2020 14:48:35 +0100 Message-Id: <20201027134900.794715749@linuxfoundation.org> X-Mailer: git-send-email 2.29.1 In-Reply-To: <20201027134900.532249571@linuxfoundation.org> References: <20201027134900.532249571@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Dan Carpenter commit b41c15f4e1c1f1657da15c482fa837c1b7384452 upstream. The "count" variable needs to be capped on every path so that we don't copy too much information to the user. Fixes: 618eabeae711 ("ALSA: bebob: Add hwdep interface") Signed-off-by: Dan Carpenter Acked-by: Takashi Sakamoto Cc: Link: https://lore.kernel.org/r/20201007074928.GA2529578@mwanda Signed-off-by: Takashi Iwai Signed-off-by: Greg Kroah-Hartman --- sound/firewire/bebob/bebob_hwdep.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) --- a/sound/firewire/bebob/bebob_hwdep.c +++ b/sound/firewire/bebob/bebob_hwdep.c @@ -37,12 +37,11 @@ hwdep_read(struct snd_hwdep *hwdep, char } memset(&event, 0, sizeof(event)); + count = min_t(long, count, sizeof(event.lock_status)); if (bebob->dev_lock_changed) { event.lock_status.type = SNDRV_FIREWIRE_EVENT_LOCK_STATUS; event.lock_status.status = (bebob->dev_lock_count > 0); bebob->dev_lock_changed = false; - - count = min_t(long, count, sizeof(event.lock_status)); } spin_unlock_irq(&bebob->lock);