Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp509994pxx; Wed, 28 Oct 2020 09:57:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxm8crCQRj30lZ14MsyQYuH/Y8z8sNMAnPnrb+vWh6Y0gblH8qRjC4Mqd5dUfDrhCS9M8fC X-Received: by 2002:a17:906:e15:: with SMTP id l21mr8875006eji.509.1603904277539; Wed, 28 Oct 2020 09:57:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603904277; cv=none; d=google.com; s=arc-20160816; b=JAnW/mSXfTTX+YixxJ76AyvvIsl/PKqLebtPDN7i0Fjr22uKGfbE7TZPV32e+yoXaK /mSQ1+cjuhZT0eUrLa+LdTOSTg+pVsdGRkAzyBedKNWjfB1jewW6mcbThEK3hZJUdKKd Zztz2Vd9+7MGZFyL+gyNotGLCKwjrNYC1+F/dlTkYaed54uvCsbIkQz5JSWbChm1WiwY nS6IDZYqog4UOJcOHP55CpqUCjVmG2K2Unr/MR0w+ziNIXPnH0APzrcO5aIfCxOQnJHj ZoJ2Rmq70wMshwbZ8TW2aNzkFlGsoG4IkPxfHz5Spn2pmvs8Rl+TYGWRF5wfXNeBS/ns RT9Q== 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=I/ll4053GGzjntUXAvc+ZwA7AgGl9KbElj/4bZhJxiQ=; b=Tjvw6den54tdQRTuveVld0SWeRG+REl9MsjSxXcqHMQ+m4l+bETRr4frhccmOCGpba T7T8b3dklRE5Gmf6gIAin4kWaWiweK5wIKokyodgXJ8VzPZQ2yLWisC/yVwM3PUcb2LS +qLsDfm8G/8SzQZnCm2kv1VypjOOK/EhZlWZjTYLvg2b0sOH6mD0INe81rhiVSIVFuPu kPD/LJq8Bn/u28cU6z6egENDaN/F3yR66C62GOQt9VCoc2ZoKeppq8Sq/kwS9ugMWKI4 Mxy9Pb/aGs/AGkko/a8+36+cl/uhIUbCAiX6WwmxZ90hWkzOMDcEPfd/H2gleM0LRZ7N M/Lw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=bzL7EF4G; 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 bs17si4061011ejb.543.2020.10.28.09.57.34; Wed, 28 Oct 2020 09:57: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=bzL7EF4G; 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 S1818994AbgJ0R0W (ORCPT + 99 others); Tue, 27 Oct 2020 13:26:22 -0400 Received: from mail.kernel.org ([198.145.29.99]:52250 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1771566AbgJ0Owd (ORCPT ); Tue, 27 Oct 2020 10:52:33 -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 B7EFC22258; Tue, 27 Oct 2020 14:52:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603810347; bh=P/bk7xuVHHNBjoKf6h+7mas2/W2ecpQm5r52hVrm8qY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bzL7EF4GMbGiagPm6mF88+55lcO3DQf454CRag/obHp08IemDXMkSrpmnOCxJcijJ LuxcEWmgGOl4QzZ1lIDtwxBJyYUSZvfKE3WUXOLX+/zGYwnKAgBhZxQKlzJtPmjDVA iFDINzllJpWDL4nhYVLhT1M+TQGUVD0ZR64VQAys= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hans Verkuil , Peilin Ye , Mauro Carvalho Chehab , Sasha Levin , syzbot+02d9172bf4c43104cd70@syzkaller.appspotmail.com Subject: [PATCH 5.8 106/633] media: vivid: Fix global-out-of-bounds read in precalculate_color() Date: Tue, 27 Oct 2020 14:47:29 +0100 Message-Id: <20201027135527.648933086@linuxfoundation.org> X-Mailer: git-send-email 2.29.1 In-Reply-To: <20201027135522.655719020@linuxfoundation.org> References: <20201027135522.655719020@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: Peilin Ye [ Upstream commit e3158a5e7e661786b3ab650c7e4d21024e8eff0f ] vivid_meta_out_process() is setting `brightness`, `contrast`, `saturation` and `hue` using tpg_s_*(). This is wrong, since tpg_s_*() do not provide range checks. Using tpg_s_*() here also makes the control framework out-of-sync with the actual values. Use v4l2_ctrl_s_ctrl() instead. This issue has been reported by syzbot as an out-of-bounds read bug in precalculate_color(). Reported-and-tested-by: syzbot+02d9172bf4c43104cd70@syzkaller.appspotmail.com Link: https://syzkaller.appspot.com/bug?extid=02d9172bf4c43104cd70 Fixes: 746facd39370 ("media: vivid: Add metadata output support") Suggested-by: Hans Verkuil Signed-off-by: Peilin Ye Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin --- drivers/media/test-drivers/vivid/vivid-meta-out.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/media/test-drivers/vivid/vivid-meta-out.c b/drivers/media/test-drivers/vivid/vivid-meta-out.c index ff8a039aba72e..95835b52b58fc 100644 --- a/drivers/media/test-drivers/vivid/vivid-meta-out.c +++ b/drivers/media/test-drivers/vivid/vivid-meta-out.c @@ -164,10 +164,11 @@ void vivid_meta_out_process(struct vivid_dev *dev, { struct vivid_meta_out_buf *meta = vb2_plane_vaddr(&buf->vb.vb2_buf, 0); - tpg_s_brightness(&dev->tpg, meta->brightness); - tpg_s_contrast(&dev->tpg, meta->contrast); - tpg_s_saturation(&dev->tpg, meta->saturation); - tpg_s_hue(&dev->tpg, meta->hue); + v4l2_ctrl_s_ctrl(dev->brightness, meta->brightness); + v4l2_ctrl_s_ctrl(dev->contrast, meta->contrast); + v4l2_ctrl_s_ctrl(dev->saturation, meta->saturation); + v4l2_ctrl_s_ctrl(dev->hue, meta->hue); + dprintk(dev, 2, " %s brightness %u contrast %u saturation %u hue %d\n", __func__, meta->brightness, meta->contrast, meta->saturation, meta->hue); -- 2.25.1