From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-ot1-f43.google.com (mail-ot1-f43.google.com [209.85.210.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 604AF3FB055 for ; Fri, 26 Jun 2026 17:12:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.43 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782493960; cv=none; b=NxZdbfJcQQ7zr2aJ2n/X9282bSpiYgyeFCCe2E/O54cA7euktI14H86Cdoza7GgTCuIPdp8HII7raR1KX7lNCPRrIgdadqxBmd+3BmnA3NTDlnVi160GyDCKUEqsLFdLp7wSHn5wDETgAROxZPwotZU49RB38xmdUst9MVF3O2E= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782493960; c=relaxed/simple; bh=FN5fyt6J8xEgwwujClfrh/tyeEwNavCdAR/kun6PwSk=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=M40rjSdOYMKSeSjoCXMQFqN1byleqW7cxPgcfD/bTIWkywP26T7GJfEuwwJb4jm9EJpIPDtHWc+4SJdU6usz5g4iVIdht0PoiywLG3WofG1S0cj/kFkjCPDy0reB6wQdRLBFIqnZi6rPIjYUOi4tmXce1ei2PxIWgUdrTFguRik= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=hw1aD77S; arc=none smtp.client-ip=209.85.210.43 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="hw1aD77S" Received: by mail-ot1-f43.google.com with SMTP id 46e09a7af769-7e6e41cf7aeso534629a34.0 for ; Fri, 26 Jun 2026 10:12:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1782493958; x=1783098758; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=1YVsyic9DZic8R7y5tzhJj17BJhHNYupyP+EXVgbeVE=; b=hw1aD77Sjc1epaKk2ZtVQGz/66x1GhTYsNQjK8tC8fWB7F4k+kxOBd1ANzfP5E/XM7 Khu3I75fNSbzglWqf9eEQt9Ppz1FIzidcb3mtdev6hWVt03fSyp+A2yucyvr+ZsOAgIx ZOhIw7kjoBdDM93zl26TgxFSwUAPDubGiYUQ3QwWUyuH+uYK7rJxG1VU0gjIPyF4Xqlq w6MKMfOZMatQBBmaq2G//NwGhTFYyFll+yEhaHk2iLfx2gKj8VrOgI6noI8V+A98UNwl Thb2Asi5pb+VSRTPdQUycmtPhMEHo9VmjhGpg8deo/fZXLuZjvRh89O6egUd7JoOobqL U36A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1782493958; x=1783098758; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-gg:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=1YVsyic9DZic8R7y5tzhJj17BJhHNYupyP+EXVgbeVE=; b=mEbSW3C85UliyQckOGUYpnefIYOdPaHGk71Qiylao1ZSd2WpaRSyRduAPWxlmbFvS3 l82kRz/pWdS6Mj9G6DJ9RzUryCBkJOj157SQ5hVzKyp1LKOfZGMlSo7VRYVRaXmaveup ABOlhQVjbocn3MOM4FMyIcQ0JjeXdr+OA2ft/E98TxhNcbN9wENIy0mng3N9mpuXvx4I 0sej20s6UsJrV5uFlSBJYbhUt9O2y6ma4SeJMyNLeYgWHFqTYY1+C0Z9dO3AtYyEQi2X Y4/nBaZMUuLxz2V0vjlkS4VqkjSOB3PeActukLl0+5IVV813+vb0OzDJOl8em69GydGf SRww== X-Forwarded-Encrypted: i=1; AFNElJ+QW9cdkc8oN6t2LN9aAIC3LYxbhLPZsEoRsyWM7bD156mtxZAB5ueXVemcTbP21qI+CMFvb1MHM2ST5hg=@vger.kernel.org X-Gm-Message-State: AOJu0YxsUoHY1VoiSJUl0MssWa1W9kWzoftyaEZv6ux7XK01k2/exj8z hA4DnsTCSe8j0tzG0t/SPZV8zmEYpCBARg8BMjzQWOj/B3c/Rd4vZwqN X-Gm-Gg: AfdE7cm8uhMMvxPFbSxxxGvgRxt3h5pg4srq55dyR/+rhg0eeVGtqiK3UnKG9QhLto1 21OK+1Mpyq/7Isk351qRBMlRac6I5T71dJTy/AWgF4mLsbixd06C9gds8vXdyczy/mGld182AmM KgPmMLEEd0y50ttGDikZdrK1IdHYOnYGQe6ySBV3bJ3X9ZO5cumKC1HQgkHEJZ7jMAYyPgMpCRs nmQjh48BxsFEiCiB7o9MaFSRssFRLmNTA/ZSauwnl+daGUq46uuF28ybeLzXXvR0Aq3qyalzlw5 wJyPKeyjRlxZuJYPeYWZ3r2TBDvfQSEPHDP14lHmQ1ID6XZkgyDGZquRvDXR767CBFr4J0uw6ci 0uVqHUV1IPnk+WtSSCrnyuWqAk2+HpPsY1CWpqHMpumpIVmw+tjtQFnP+dNsb/ZqMBzkTAdkHVU BFvvUp X-Received: by 2002:a05:6830:6af3:b0:7e5:b3f6:c6ad with SMTP id 46e09a7af769-7e99bf39192mr6725995a34.4.1782493958242; Fri, 26 Jun 2026 10:12:38 -0700 (PDT) Received: from localhost ([74.80.182.98]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-7e9aa5d3554sm2112298a34.9.2026.06.26.10.12.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Jun 2026 10:12:37 -0700 (PDT) Date: Fri, 26 Jun 2026 20:12:31 +0300 From: Dan Carpenter To: Doruk Tan Ozturk Cc: Hans de Goede , Andy Shevchenko , Mauro Carvalho Chehab , Greg Kroah-Hartman , Sakari Ailus , linux-media@vger.kernel.org, linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/2] media: atomisp: validate sizeimage against the allocated frame in framebuffer-to-CSS Message-ID: References: <023f2124beb3d2fe9ab0ab6bd31717f0a6c9ff81.1782484857.git.doruk@0sec.ai> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <023f2124beb3d2fe9ab0ab6bd31717f0a6c9ff81.1782484857.git.doruk@0sec.ai> On Fri, Jun 26, 2026 at 06:40:41PM +0200, Doruk Tan Ozturk wrote: > atomisp_v4l2_framebuffer_to_css_frame() allocates the CSS frame > (res->data) from arg->fmt.{width,height,format} but then > hmm_store()s arg->fmt.sizeimage bytes into it. sizeimage is an > independent user-controlled v4l2_pix_format field with no cross-check, so > a sizeimage larger than the allocated frame overflows res->data (ISP/hmm > memory). Reject sizeimage > res->data_bytes before the store. > > Found by static analysis; not yet runtime-reproduced (Intel Atom ISP > hardware required). > > Found by 0sec's autonomous vulnerability analysis (https://0sec.ai). > > Signed-off-by: Doruk Tan Ozturk We need a Fixes tag for all three of these patches. > --- > drivers/staging/media/atomisp/pci/atomisp_cmd.c | 10 ++++++++++ > 1 file changed, 10 insertions(+) > > diff --git a/drivers/staging/media/atomisp/pci/atomisp_cmd.c b/drivers/staging/media/atomisp/pci/atomisp_cmd.c > index 6cd500d9f..966b84402 100644 > --- a/drivers/staging/media/atomisp/pci/atomisp_cmd.c > +++ b/drivers/staging/media/atomisp/pci/atomisp_cmd.c > @@ -3331,6 +3331,16 @@ atomisp_v4l2_framebuffer_to_css_frame(const struct v4l2_framebuffer *arg, > goto err; > } > > + /* > + * sizeimage is a separate user-controlled v4l2_pix_format field; the > + * frame above was sized from width/height/format. Reject a sizeimage > + * that would overflow the allocated frame in the hmm_store() below. > + */ > + if (arg->fmt.sizeimage > res->data_bytes) { > + ret = -EINVAL; > + goto err; > + } The math to calculate the size from width/height in frame_init_raw_single_plane() and similar functions looks like it has integer overflow bugs as well. regards, dan carpenter