Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp691341rwr; Thu, 4 May 2023 08:23:55 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4oIGf6PvvD+sh6ovzdhxMwsQ2Hag6296cLpRqglV31XZbXf1ED72HOnTmvbLg87fLe9dXM X-Received: by 2002:a05:6a20:6a1f:b0:ef:205f:8184 with SMTP id p31-20020a056a206a1f00b000ef205f8184mr3588740pzk.13.1683213835627; Thu, 04 May 2023 08:23:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683213835; cv=none; d=google.com; s=arc-20160816; b=J9+F9+2QwxBJ+i1aORaXqZ4+gnfAu1D079fvkDvzbiYu9FFhD0yaO9xUgNhjdF/KSw pOPHfaClpWqUHPCTo9yKgx+OlKK/zUgMQ3DbQAv+3CxpGt5Ky/oswjSHApLsFPZvbJ06 u+jXPoffNNO6Rr7yQSBUNiAyAVvSAogpi0Y0mMVjz2x4uy9keUFiDWPrg7GWtzW+Zrnp fNp9I8woUj99VEJr9arEWcuOSabua+y7Oi3qOKFpc+hPrfX7T9nAv6zHOYIULoq2VH5C QQsDYR5hvpFrZvPT67rX+GBkOzZ9tZMZMkPypZLUxQY0vJNv1BDtQHhGAACND5xBnWrv GY1A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=JTPkoO3wtXrwbDkuqDWZwudoUsIkD1id0eTEvf6kT/Y=; b=qMKSxYRBPpmdANKjUXhe7iinv01PIYy8NRhpNYwhsgf0H9FvO7Au5ke0JyI6KKAZMM t7Bu6Vw1keO1UqaHeq2DOIZakuUCu3WLgak9gY7M6oTlgnaFfniaFFuaoI4qeCi2qd6C nGsCsA66GjwEATw9mcNth/hM8NgO7sdM+6fK2XVwzdKV+Eb6P1w6kTMZJPk3r/s1CSHm MGYAvY1TBtzvo65LlzMHeHmf4KD+S4vnNoj5yz9oRVr1+k2GFPXXIfuul86bWRZngBjo k4TvhbEcnlnXHhU05AKsSkpkpGoce/XAH8r8XdEepxBiTRCim/+ilh9imbTqNcPyJ0tT V1ow== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="RGc7/jfZ"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t10-20020a63f34a000000b0051a8a22a43csi34978150pgj.450.2023.05.04.08.23.42; Thu, 04 May 2023 08:23:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="RGc7/jfZ"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231447AbjEDO4W (ORCPT + 99 others); Thu, 4 May 2023 10:56:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47118 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230481AbjEDOz4 (ORCPT ); Thu, 4 May 2023 10:55:56 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1EC179EE9 for ; Thu, 4 May 2023 07:54:36 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 53AE26301C for ; Thu, 4 May 2023 14:54:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AC219C433D2; Thu, 4 May 2023 14:54:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1683212052; bh=TmACzxlSeb+WERvLsvXQwELOey/j51OsQ52OPnlwneM=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=RGc7/jfZgBMqdOT/Q8ZklvtXELuPyC9G8Adup84Tf9khzhzWdDv88vQQ9IDmJm1Sf 1n4pccodaWrjOOxU2AuhH0AhIf+m75+vtQOctPrO6jmPvVaoQPuaazFvTkDj3ZNCcs KxlZJowPBY61AortnBGbZBlPSZKNmF2RT4k+MD6kTJmdctso3MMxdpxf+KgWg7YI3t h7TvpRp4hQ3t65AbR3jzyG4LkkR10bddkOijzbDvowHKWwjpWhdRqbA1jpg/nWKPh7 p91/odYPl18phx6XoRXPLc0MerVB7Vh/KE/eL4BlsoeVvQy/kkeOMc6FRbd/DjbBIr ANWGE77uzyqFQ== Received: from johan by xi.lan with local (Exim 4.94.2) (envelope-from ) id 1puaLc-0004eW-Oc; Thu, 04 May 2023 16:54:21 +0200 Date: Thu, 4 May 2023 16:54:20 +0200 From: Johan Hovold To: Dongliang Mu Cc: Alex Elder , Greg Kroah-Hartman , Jacopo Mondi , Laurent Pinchart , Greg Kroah-Hartman , greybus-dev@lists.linaro.org, linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org Subject: Re: [PATCH] drivers: staging: greybus: fix GPF issue in gb_camera_capture Message-ID: References: <20230504135841.1566958-1-dzm91@hust.edu.cn> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230504135841.1566958-1-dzm91@hust.edu.cn> X-Spam-Status: No, score=-4.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, May 04, 2023 at 09:58:41PM +0800, Dongliang Mu wrote: > In gb_camera_capture(), it does not check the value of settings > before dereferencing it. And gb_camera_debugfs_capture calls > gb_camera_capture with the 6th parameter settings as NULL. Looks like you just broke gb_camera_debugfs_capture() which relies on passing NULL as settings. > Fix this by checking the value of setting at the starting of > gb_camera_capture. > > Fixes: 3265edaf0d70 ("greybus: Add driver for the camera class protocol") > Signed-off-by: Dongliang Mu > --- > drivers/staging/greybus/camera.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/staging/greybus/camera.c b/drivers/staging/greybus/camera.c > index cdbb42cd413b..5a4b26e7f645 100644 > --- a/drivers/staging/greybus/camera.c > +++ b/drivers/staging/greybus/camera.c > @@ -659,7 +659,7 @@ static int gb_camera_capture(struct gb_camera *gcam, u32 request_id, > size_t req_size; > int ret; > > - if (settings_size > GB_CAMERA_MAX_SETTINGS_SIZE) > + if (settings_size > GB_CAMERA_MAX_SETTINGS_SIZE || !settings) > return -EINVAL; > > req_size = sizeof(*req) + settings_size; Johan