Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp4608835pxj; Wed, 12 May 2021 09:10:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyQ2QmqucGln/4un5dAUWCpVpgJZp0mWaH/tZp4bjYhPT7iFpGVIRkST9gC4WonCrZcLrTF X-Received: by 2002:aa7:de02:: with SMTP id h2mr44278607edv.61.1620835809251; Wed, 12 May 2021 09:10:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620835809; cv=none; d=google.com; s=arc-20160816; b=GmOCCfR4P6e8JUnSOmPPfumaAQ+/zhWe9Ftxi2joIlxp5HjwESiZXpt8UhJVMqp2SF dI3cPQGsJqY6K5SLK+Wtp0a0LxZnenN71kR/EekHtUdRy+jm9m7JoUosRHCYSoTALp9a 8yHYO42vSWZpgxJkv3nLi92E/h8uq+HJ5SPzsuT1cMF926SlLRvUXy8V8M4eFnDdL/AC ab0qLtRWgmzJI/wy8uDLNEia7rclzZy2kEmKgcymHn8hOwVhQQvmMacpiNw6CAFGn33C +GLag3DDUCA0BCkoLaCoVXcAUlUuieysxGPYKoZdzrJ1EfPVmCVnyudsrBtz7FMDJKX9 +D/Q== 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=lKajUeh90gdYkKAnH4pSaU0ym1UTIXsWbbwc4mpqmms=; b=usg9gtgg2XVj1snAdVwUWq8/Qha4ZOmO2rZrkIsrKK4Q9Rd7h2TSqzymjBlI6QT+sl V44vCmCFLhqVR+RAGCnpWFV6f9IOzjzJ12+Mbq6GUPodtKUhoavgsnaaCqGaeqJ8s+o8 +hQaHHtSSqPajeQ6q7FBPiiJV09oYAVt+5VKEKm3rGPdQHip+H5hWVxWDQM63eovleH7 iJxZ4cCxskExtLxcVatiBbx109Rc8+NeZnOvdc6bLdnobBPXIhYxEeNFmREBcqjDOrJF UjzhuRoXOcn+2QrZh6l7nv1aH3mI7ukJr031+VQcZCODyUBTSrNgY+6mmNVqMA5vjiD0 UiGw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="xMsJN/nZ"; 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 z2si251231eju.563.2021.05.12.09.09.44; Wed, 12 May 2021 09:10:09 -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="xMsJN/nZ"; 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 S239324AbhELQHw (ORCPT + 99 others); Wed, 12 May 2021 12:07:52 -0400 Received: from mail.kernel.org ([198.145.29.99]:40992 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235642AbhELP2n (ORCPT ); Wed, 12 May 2021 11:28:43 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 74C51613AF; Wed, 12 May 2021 15:14:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1620832462; bh=6w7TqbEPhJJFeiN8jvIQ29HQqDs43kksLmXQyng8Q1w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xMsJN/nZlUp8phzzZnr/CIYRH0TDML1NshM/OuO46g/6NYzpP/zCJGb7Z6H1f0kIu 1T8w6CrST3gZyizbfw51bcrhTF/lhgmfnzisl39U+6wdW7S95ufrfEgywwhdMBXIkv SrtdimJKQ0sZrqNukQ3wBZ/LEVOHqeNS2GzJmLDI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dafna Hirschfeld , Helen Koike , Sebastian Fricke , Hans Verkuil , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 5.10 288/530] media: rkisp1: rsz: crash fix when setting src format Date: Wed, 12 May 2021 16:46:38 +0200 Message-Id: <20210512144829.274236695@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210512144819.664462530@linuxfoundation.org> References: <20210512144819.664462530@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: Dafna Hirschfeld [ Upstream commit cbe8373ca7e7cbb4b263b6bf222ccc19f5e119d2 ] When setting the source media bus code in the resizer, we first check that the current media bus code in the source is yuv encoded format. This is done by retrieving the data from the formats list of the isp entity. This cause a crash when the media bus code on the source is YUYV8_1_5X8 which is not supported by the isp entity. Instead we should test the sink format of the resizer which is guaranteed to be supported by the isp entity. Fixes: 251b6eebb6c49 ("media: staging: rkisp1: rsz: Add support to more YUV encoded mbus codes on src pad") Signed-off-by: Dafna Hirschfeld Acked-by: Helen Koike Tested-by: Sebastian Fricke Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin --- drivers/staging/media/rkisp1/rkisp1-resizer.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/staging/media/rkisp1/rkisp1-resizer.c b/drivers/staging/media/rkisp1/rkisp1-resizer.c index 1687d82e6c68..4dcc342ac2b2 100644 --- a/drivers/staging/media/rkisp1/rkisp1-resizer.c +++ b/drivers/staging/media/rkisp1/rkisp1-resizer.c @@ -520,14 +520,15 @@ static void rkisp1_rsz_set_src_fmt(struct rkisp1_resizer *rsz, struct v4l2_mbus_framefmt *format, unsigned int which) { - const struct rkisp1_isp_mbus_info *mbus_info; - struct v4l2_mbus_framefmt *src_fmt; + const struct rkisp1_isp_mbus_info *sink_mbus_info; + struct v4l2_mbus_framefmt *src_fmt, *sink_fmt; + sink_fmt = rkisp1_rsz_get_pad_fmt(rsz, cfg, RKISP1_RSZ_PAD_SINK, which); src_fmt = rkisp1_rsz_get_pad_fmt(rsz, cfg, RKISP1_RSZ_PAD_SRC, which); - mbus_info = rkisp1_isp_mbus_info_get(src_fmt->code); + sink_mbus_info = rkisp1_isp_mbus_info_get(sink_fmt->code); /* for YUV formats, userspace can change the mbus code on the src pad if it is supported */ - if (mbus_info->pixel_enc == V4L2_PIXEL_ENC_YUV && + if (sink_mbus_info->pixel_enc == V4L2_PIXEL_ENC_YUV && rkisp1_rsz_get_yuv_mbus_info(format->code)) src_fmt->code = format->code; -- 2.30.2