Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp59378pxf; Tue, 9 Mar 2021 23:49:23 -0800 (PST) X-Google-Smtp-Source: ABdhPJxSosOvcpExz/syMaY8gOhrxBwHsQ7n8MWJV4HeOKg6YlU6Z4aF78qcYpQgIMXS/XCiNnbo X-Received: by 2002:aa7:d4d6:: with SMTP id t22mr1875223edr.376.1615362563631; Tue, 09 Mar 2021 23:49:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1615362563; cv=none; d=google.com; s=arc-20160816; b=ooBshIoCMftOHNMuRLPWcp3R7PeNgl6dhPNJLo/yOrrVnDG3mBeljxrlLBVzHSCbyy EkHr77VgvqrIC6v5k+WbKPCt6vnhhA11YOLOtkeMot7gosGKlyvJXQZFv/Jzbn9nGsmp 3mwDvEG2BEbwuTtFeISzFir1UCqH72yh2FYbQSXccMjAJe1tzImgX/AyLFEsMcN8NUQ3 9bFXHeN70HRqNv3LoswJsfcrZn5icAmi6Vbm4Yj9CpuFqO0D5DUahIQMLoES18cZ9VQH 4d9+oVUOI/s3HpyHghTSgvSaLThyl3Lubk3/bkfi+c+CTFmX2GK4IB+qP5Gx0LQqzr6J W0sQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=vYY3kS7qglSEso/PjkszA2pK+2X+kS7u7XRoyYJZSxE=; b=NbDAWgp3fbpbNnHTK0VHaiRV1NfqaZcNRMvnUr4gbgBkFr1vJXm1zoNX7mmaCsttso qxN26jWy4rfLbLxEASCbTuJSNa2yppMTZnTGQmT3AsVO0qrdyrO1XslARRJbOiImvWfG 2jox29xyIlnpAxOafr2fU4Zx6DvYFAYkkeqPg417HKb/86GQqxFmI7vJTHwGV/NySu6i Eolh5xApBxvXsOpj9oynGFyXxcACiCB8DT/Vmmf3ZKLnsHRajfp8/ShQcoYOec34H40G Kj/vH5lZ/roDYulyQEcDMb6AXcKiAIDr17RRpIZVe8oqzEwro3+p+BQ02FU+izERL8+6 Ob2w== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id gf2si11103391ejb.736.2021.03.09.23.49.01; Tue, 09 Mar 2021 23:49:23 -0800 (PST) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232030AbhCJHsA (ORCPT + 99 others); Wed, 10 Mar 2021 02:48:00 -0500 Received: from mx2.suse.de ([195.135.220.15]:56338 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231208AbhCJHry (ORCPT ); Wed, 10 Mar 2021 02:47:54 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id C7605AD87; Wed, 10 Mar 2021 07:47:52 +0000 (UTC) Subject: Re: [PATCH] media: videobuf2: Fix integer overrun in vb2_mmap To: Ricardo Ribalda , Tomasz Figa , Marek Szyprowski , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Sergey Senozhatsky , stable@vger.kernel.org References: <20210310074028.1042475-1-ribalda@chromium.org> From: Jiri Slaby Message-ID: <48e8ffd7-7f42-8e22-bf9d-646d9bd89bd9@suse.cz> Date: Wed, 10 Mar 2021 08:47:51 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.7.0 MIME-Version: 1.0 In-Reply-To: <20210310074028.1042475-1-ribalda@chromium.org> Content-Type: text/plain; charset=iso-8859-2; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 10. 03. 21, 8:40, Ricardo Ribalda wrote: > The plane_length is an unsigned integer. So, if we have a size of > 0xffffffff bytes we incorrectly allocate 0 bytes instead of 1 << 32. > > Suggested-by: Sergey Senozhatsky > Cc: stable@vger.kernel.org > Fixes: 7f8414594e47 ("[media] media: videobuf2: fix the length check for mmap") > Signed-off-by: Ricardo Ribalda > --- > drivers/media/common/videobuf2/videobuf2-core.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/media/common/videobuf2/videobuf2-core.c b/drivers/media/common/videobuf2/videobuf2-core.c > index 543da515c761..876db5886867 100644 > --- a/drivers/media/common/videobuf2/videobuf2-core.c > +++ b/drivers/media/common/videobuf2/videobuf2-core.c > @@ -2256,7 +2256,7 @@ int vb2_mmap(struct vb2_queue *q, struct vm_area_struct *vma) > * The buffer length was page_aligned at __vb2_buf_mem_alloc(), > * so, we need to do the same here. > */ > - length = PAGE_ALIGN(vb->planes[plane].length); > + length = PAGE_ALIGN((unsigned int)vb->planes[plane].length); Hi, I fail to see how case from uint to uint helps -- IOW, did you mean ulong? regards, -- js suse labs