Message ID | 20240726072814.3534601-1-nichen@iscas.ac.cn (mailing list archive) |
---|---|
State | Changes Requested |
Headers |
Received: from am.mirrors.kernel.org ([147.75.80.249]) by linuxtv.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from <linux-media+bounces-15353-patchwork=linuxtv.org@vger.kernel.org>) id 1sXFQr-0006jf-0b for patchwork@linuxtv.org; Fri, 26 Jul 2024 07:32:08 +0000 Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id B35151F2282B for <patchwork@linuxtv.org>; Fri, 26 Jul 2024 07:32:02 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D1029176248; Fri, 26 Jul 2024 07:31:57 +0000 (UTC) X-Original-To: linux-media@vger.kernel.org Received: from cstnet.cn (smtp84.cstnet.cn [159.226.251.84]) (using TLSv1.2 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1B69F175568; Fri, 26 Jul 2024 07:31:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=159.226.251.84 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1721979117; cv=none; b=r6Fn1OyD0JN1ALmLq3i4o9ADLjja3b9EL55VTu3d5HBhMRY+9B6VR/03/jV0QqqgF/hphA6PijCRDrky0jImqi804tEyQBEsrwHEvQ58flBSP5PLe4fXOba+1Nc6pmBA0Q1B7iXApjPyn5qVBzZHAhoqFLOVLbBpl4sumAaeuR4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1721979117; c=relaxed/simple; bh=wizgaX8bVKCtAjlagtQiA7uk0rd5sy0wKoNtzjoYfTc=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=ENLzNlOuXB5/mshSXdSh5fTZuplnHWG0UdMsrYLhXWqzJTYJKl8mKyNscu1+Ug34RpT+U0IZc35Z5gjOS0jkm59VLB8rKSprQTXsYVakTCR+lVRSI0Es+XjSa99EVNqVpDHk1dNYt9J8lG1aUHdZMweL/KB3xdaXTXpYumt0vvA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=iscas.ac.cn; spf=pass smtp.mailfrom=iscas.ac.cn; arc=none smtp.client-ip=159.226.251.84 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=iscas.ac.cn Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=iscas.ac.cn Received: from localhost (unknown [124.16.138.129]) by APP-05 (Coremail) with SMTP id zQCowABnTTjUUKNmns0gAQ--.65077S2; Fri, 26 Jul 2024 15:31:33 +0800 (CST) From: Chen Ni <nichen@iscas.ac.cn> To: laurent.pinchart@ideasonboard.com, mchehab@kernel.org, gregkh@linuxfoundation.org, sakari.ailus@linux.intel.com, hverkuil-cisco@xs4all.nl Cc: linux-media@vger.kernel.org, linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org, Chen Ni <nichen@iscas.ac.cn> Subject: [PATCH] staging: media: omap4iss: add check for media_pad_remote_pad_first Date: Fri, 26 Jul 2024 15:28:14 +0800 Message-Id: <20240726072814.3534601-1-nichen@iscas.ac.cn> X-Mailer: git-send-email 2.25.1 Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: <linux-media.vger.kernel.org> List-Subscribe: <mailto:linux-media+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-media+unsubscribe@vger.kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CM-TRANSID: zQCowABnTTjUUKNmns0gAQ--.65077S2 X-Coremail-Antispam: 1UD129KBjvdXoW7Wr4DJ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q/ X-LSpam-Score: -2.5 (--) X-LSpam-Report: No, score=-2.5 required=5.0 tests=ARC_SIGNED=0.001,ARC_VALID=-0.1,BAYES_00=-1.9,DMARC_MISSING=0.001,HEADER_FROM_DIFFERENT_DOMAINS=0.5,MAILING_LIST_MULTI=-1,SPF_HELO_NONE=0.001,SPF_PASS=-0.001 autolearn=ham autolearn_force=no |
Series |
staging: media: omap4iss: add check for media_pad_remote_pad_first
|
|
Commit Message
Chen Ni
July 26, 2024, 7:28 a.m. UTC
Add check for the return value of media_pad_remote_pad_first() and
return the error if it fails in order to avoid NULL pointer dereference.
Fixes: b2e44430b634 ("media: mc-entity: Rename media_entity_remote_pad() to media_pad_remote_pad_first()")
Signed-off-by: Chen Ni <nichen@iscas.ac.cn>
---
drivers/staging/media/omap4iss/iss_csi2.c | 3 +++
1 file changed, 3 insertions(+)
Comments
On Fri, Jul 26, 2024 at 03:28:14PM +0800, Chen Ni wrote: > Add check for the return value of media_pad_remote_pad_first() and > return the error if it fails in order to avoid NULL pointer dereference. > > Fixes: b2e44430b634 ("media: mc-entity: Rename media_entity_remote_pad() to media_pad_remote_pad_first()") > Signed-off-by: Chen Ni <nichen@iscas.ac.cn> > --- > drivers/staging/media/omap4iss/iss_csi2.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/drivers/staging/media/omap4iss/iss_csi2.c b/drivers/staging/media/omap4iss/iss_csi2.c > index 0e6c5bd81930..43851bbd0cc3 100644 > --- a/drivers/staging/media/omap4iss/iss_csi2.c > +++ b/drivers/staging/media/omap4iss/iss_csi2.c > @@ -539,6 +539,9 @@ static int csi2_configure(struct iss_csi2_device *csi2) > return -EBUSY; > > pad = media_pad_remote_pad_first(&csi2->pads[CSI2_PAD_SINK]); > + if (!pad) > + return -EPIPE; How was this found and tested? thanks, greg k-h
On Fri, Jul 26, 2024 at 03:28:14PM +0800, Chen Ni wrote: > Add check for the return value of media_pad_remote_pad_first() and > return the error if it fails in order to avoid NULL pointer dereference. > > Fixes: b2e44430b634 ("media: mc-entity: Rename media_entity_remote_pad() to media_pad_remote_pad_first()") That Fixes tag isn't correct. The patch just renamed the function. When I look at that patch, the isp_pipeline_is_last() function doesn't check for NULL either. Why is that one different? regards, dan carpenter
diff --git a/drivers/staging/media/omap4iss/iss_csi2.c b/drivers/staging/media/omap4iss/iss_csi2.c index 0e6c5bd81930..43851bbd0cc3 100644 --- a/drivers/staging/media/omap4iss/iss_csi2.c +++ b/drivers/staging/media/omap4iss/iss_csi2.c @@ -539,6 +539,9 @@ static int csi2_configure(struct iss_csi2_device *csi2) return -EBUSY; pad = media_pad_remote_pad_first(&csi2->pads[CSI2_PAD_SINK]); + if (!pad) + return -EPIPE; + sensor = media_entity_to_v4l2_subdev(pad->entity); pdata = sensor->host_priv;