Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp537851pxx; Wed, 28 Oct 2020 10:34:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyXvd2RRt4VnU4sUukJETws2+pGmAukXGBMs5s4II/uCyOzEI6w1b5sR2tw/RqsiynR/IFG X-Received: by 2002:aa7:cd42:: with SMTP id v2mr8577924edw.191.1603906457123; Wed, 28 Oct 2020 10:34:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603906457; cv=none; d=google.com; s=arc-20160816; b=Cx12fSK4FdIFj2mF0jy28CqDZZx9FWy8CYACxpQxV+BfLruiJ4touAgKjXMxlJlKTg gdFZrTJEpBUhBEk3fclkE9jbmq3j4mfGF9WpDairW6BFc6RPdPc6jHTQqHC4C6JKPG6W ocYbQlG/iLIUssc66y/aQ1wxXkSuZqkkoU5GNCeNFZFzBnCYLiLO0Y2UZZsg2oz37cus gOaYD21Fle1IFSLj8jE1kjup/SofE6vzZ5QSmmIBv9slEjUKMm0z67kEamNWexQSu60n suZwC+4ZDHQsPkJK+brZWXceWmIfECwO1SIw3TkXkn4LqzlXedMFANv/EeFM/prTFmcn v3WQ== 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=DawsjLjKLodEs5JwL30eG3Qb8EkuEftBBq4E+mqINY0=; b=GlAHOf3OkOQEiiGs5fCaPyuxIS873YwxUHaxDLtzMFSQyZGk/zMDdxH+lO8plgIaCf CHngPfmaQ55WyZXyyK7zNIuZHLkjZfIIS1cQkOfVbHXIkyiGTVUB8dAb+MOx1aBLvInm v0j/xWbdmCZkW6KI5KBNj1EKfy5V6cBShv5hFRsu1gKrcKeTlr94TP/VBMBQMWnWKPVm 7B9WvzCBkcxwH8kYdoKmNC+i3Es/HGP1liMhYGVVIm85wcWqTAs95OR8kISF8lVwY8or 1YErp0J9qo/Ma14b56XUh4y5rSzdEBWdRSPu1YYzVEIdJAFiJpPdErioAG9iC7s32GK1 Zq3w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Bo5rswbF; 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 e13si3955588ejq.552.2020.10.28.10.33.53; Wed, 28 Oct 2020 10:34:17 -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=Bo5rswbF; 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 S1822119AbgJ0RrH (ORCPT + 99 others); Tue, 27 Oct 2020 13:47:07 -0400 Received: from mail.kernel.org ([198.145.29.99]:57182 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2896833AbgJ0Oah (ORCPT ); Tue, 27 Oct 2020 10:30:37 -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 AC4ED20780; Tue, 27 Oct 2020 14:30:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603809037; bh=mpM/eNc1qPCXevA0Cv9TCas8brCKRl1fN7wjoo6bpVU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Bo5rswbFOdhgWvC/bvCbgGYxGjg/0xMQOFvkXv8AMiL47aYy0EFKUlaWxcdNfG2dM B3UrAyObSYIGJaDfl1ZxVpH2zLAvGGnFVOii0KXwWkGWV4xbyG2Kq+1UIUoJrLK16p wmm1X1fJp0KkqVjPI9fJoazjx7zsz/uNY74rEfs0= 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 5.4 021/408] ALSA: bebob: potential info leak in hwdep_read() Date: Tue, 27 Oct 2020 14:49:19 +0100 Message-Id: <20201027135456.041009132@linuxfoundation.org> X-Mailer: git-send-email 2.29.1 In-Reply-To: <20201027135455.027547757@linuxfoundation.org> References: <20201027135455.027547757@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 @@ -36,12 +36,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);