Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2484212pxj; Mon, 10 May 2021 04:12:29 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxZ4+qq+tDP//BogsmwiD677EIiU6kkZndhqbYb8/aoNvT5rhrwrHZUR5C9p/i+nHoEeYKI X-Received: by 2002:a6b:fb0a:: with SMTP id h10mr13981025iog.167.1620645063275; Mon, 10 May 2021 04:11:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620645063; cv=none; d=google.com; s=arc-20160816; b=vaH9iPFXi3nPIZ4wLRq3h1n5Rf/Ltt9N2/Y8dTedHJgCZTHP84WXBcSZZ8J7P3rPpA qphsmmMf6mZGEDj/C+oyyX18aqGpi77AwVnipQm+WfVgAIR1hhTNCBEzJoY9gXQLgz0/ tyuu8DasYUCel7WxstF4tET6nufbr5nKant8v6ThlTz1Tpzw+T+lnrgLoNTvGhx3WpX3 FtMyy12PS1fo/74T6GY2kXL9BXfyrsgflOa+dVi8sncMaOh/tn2AeVHPYur1gwAQhNyN cQqyiDFstuDywWPMuPTKAgHSuWkxJJqo3+DaR09SPwFMNf+GsCAdwWxzZNmuUNGPRhKp kjbQ== 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=ixxbwXR7vPESkTnaV50Aqt8xcOKI/Wg5yfJjirzKECQ=; b=W4sAibZi5XCtAG+g3TQLESFF2x+LZQf89B+V/QLGKBDotZTO8pmoa4rpEke5DWiG2+ dgCa9aJH8/aHC7Chgu8/2FD0jOycCRzgvLsEaw+YtZtumjp5E6DbBeTYb2fs1rMzYJfr jbxbFDV0UCBupST00Fo7jdhcuRln/ShPLxRcSdu5YtML0S2rx7HDnkgTnoVfQNhuTfb7 0MW/pXsxKwL3XrryUzV+xguA+AGkaHBWLhQoxZe4F/DYWFS3efTN5LoAI+LciGojOuID 4tcaf8RAol1yiJvwE5Z8pJTIjClmzh7ZR9g3UIRoxiYoZYe1s72g0gJsCakUyTeRuyZN xTOw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=jodbXt7l; 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=pass (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 u12si17075146ilm.67.2021.05.10.04.10.51; Mon, 10 May 2021 04:11:03 -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=@linuxfoundation.org header.s=korg header.b=jodbXt7l; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234627AbhEJLFH (ORCPT + 99 others); Mon, 10 May 2021 07:05:07 -0400 Received: from mail.kernel.org ([198.145.29.99]:58338 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233409AbhEJKpo (ORCPT ); Mon, 10 May 2021 06:45:44 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id DB7A3616ED; Mon, 10 May 2021 10:36:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1620642986; bh=XCtJfkGFbC2VRs0fahHq2Xv98B7QeAWABesY4G/UWe4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jodbXt7lCgchSEeVODtCj5FcRlun5YiHQrheZMfpOhSjsu3Krrm37AqC9mCm3s1MW JcrSsGDfOzUKoCo/T9LEgJWnmOEBPuknSykaf0EV+HSCab7CkTjTb3sXcEHZvsBRrw GYyoQzNBQMV4X6XHnwClz3dd2RyCQ4H8ZdIj7Ts4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Carpenter , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.10 132/299] atomisp: dont let it go past pipes array Date: Mon, 10 May 2021 12:18:49 +0200 Message-Id: <20210510102009.330912169@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210510102004.821838356@linuxfoundation.org> References: <20210510102004.821838356@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: Mauro Carvalho Chehab [ Upstream commit 1f6c45ac5fd70ab59136ab5babc7def269f3f509 ] In practice, IA_CSS_PIPE_ID_NUM should never be used when calling atomisp_q_video_buffers_to_css(), as the driver should discover the right pipe before calling it. Yet, if some pipe parsing issue happens, it could end using it. So, add a WARN_ON() to prevent such case. Reported-by: Dan Carpenter Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin --- drivers/staging/media/atomisp/pci/atomisp_fops.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/staging/media/atomisp/pci/atomisp_fops.c b/drivers/staging/media/atomisp/pci/atomisp_fops.c index 453bb6913550..f1e6b2597853 100644 --- a/drivers/staging/media/atomisp/pci/atomisp_fops.c +++ b/drivers/staging/media/atomisp/pci/atomisp_fops.c @@ -221,6 +221,9 @@ int atomisp_q_video_buffers_to_css(struct atomisp_sub_device *asd, unsigned long irqflags; int err = 0; + if (WARN_ON(css_pipe_id >= IA_CSS_PIPE_ID_NUM)) + return -EINVAL; + while (pipe->buffers_in_css < ATOMISP_CSS_Q_DEPTH) { struct videobuf_buffer *vb; -- 2.30.2