From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B56E1C4320A for ; Wed, 1 Sep 2021 07:13:00 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 99DC161056 for ; Wed, 1 Sep 2021 07:13:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242546AbhIAHNz (ORCPT ); Wed, 1 Sep 2021 03:13:55 -0400 Received: from mail-vk1-f178.google.com ([209.85.221.178]:35711 "EHLO mail-vk1-f178.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242416AbhIAHNx (ORCPT ); Wed, 1 Sep 2021 03:13:53 -0400 Received: by mail-vk1-f178.google.com with SMTP id ay16so654562vkb.2; Wed, 01 Sep 2021 00:12:57 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=5OIZaaJOxzSwlBAyVUTzzSJStZdPh3eIjP+iaY26uus=; b=FHXuojNTTpC+ZyjBVdhvYEHNzW/PCMoIvyGyU5Excw/vlwxtwlfeQnDBDULuku+jtr 81Qo2w5pc201jqXkDXQY10+3nBtGDke+MM5zSyBpTsq8m2pHJ/CmoAZq+kugjX1xCUvT R7egXRToay0PDzytwqyGaKcEMTRd92/2QixFhFVlCtrwEYC4jvZ9RqRuCZFsO/UQmYPP zD8henrwJ8xfxYggxsGS42JMI2UMx7Cv2midoKj1BSipmZygtSKsfqCdSiAhG5igSMcn uHz6wXNtBqfyg6UpBR9FVtbxM/94e8UeaWWI3HVOQxfLCVRnAvMDWvuHLxfpFdl5w//r AY4Q== X-Gm-Message-State: AOAM531wMcwQEG/grPCwMO9f2u9g114kLUVk4fcNNSS7l2TIr1LPEl5D iWkUQkT5SdGhxzDHF012Y3XlPJ76pG5cZ02Bmbu5LvYg X-Google-Smtp-Source: ABdhPJwQRLNOZObA78mZsGR2waDSEdFHfN+IPMckzWjh/Ic7JlwZtxoUt2HD8opLWAKvAPdjb/g3GaV+9/HP/TK9CG8= X-Received: by 2002:a1f:2c97:: with SMTP id s145mr20725423vks.24.1630480377050; Wed, 01 Sep 2021 00:12:57 -0700 (PDT) MIME-Version: 1.0 References: <000000000000815b9605c70e74f8@google.com> <131b24e5-ee31-6f7b-42b4-c34583711913@infradead.org> <2fccb5d3-191c-924e-159f-1c9d423e282f@i-love.sakura.ne.jp> <339bfb21-8e80-c7d9-46dd-c416f87c50c0@infradead.org> <535e404d-03bf-8e7a-b296-132a2a98c599@i-love.sakura.ne.jp> <5c6d2b95-31d7-0d59-5e62-2593d9a0e1fe@i-love.sakura.ne.jp> <750ed1ae-de80-b232-4aea-79d60c212fab@i-love.sakura.ne.jp> In-Reply-To: <750ed1ae-de80-b232-4aea-79d60c212fab@i-love.sakura.ne.jp> From: Geert Uytterhoeven Date: Wed, 1 Sep 2021 09:12:45 +0200 Message-ID: Subject: Re: [PATCH v2] fbmem: don't allow too huge resolutions To: Tetsuo Handa Cc: Daniel Vetter , syzbot , Andrew Morton , Bartlomiej Zolnierkiewicz , Colin King , DRI Development , Linux Fbdev development list , Linux Kernel Mailing List , Masahiro Yamada , syzkaller-bugs , Randy Dunlap Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Sep 1, 2021 at 3:15 AM Tetsuo Handa wrote: > syzbot is reporting page fault at vga16fb_fillrect() [1], for > vga16fb_check_var() is failing to detect multiplication overflow. > > if (vxres * vyres > maxmem) { > vyres = maxmem / vxres; > if (vyres < yres) > return -ENOMEM; > } > > Since no module would accept too huge resolutions where multiplication > overflow happens, let's reject in the common path. > > Link: https://syzkaller.appspot.com/bug?extid=04168c8063cfdde1db5e [1] > Reported-by: syzbot > Debugged-by: Randy Dunlap > Signed-off-by: Tetsuo Handa Reviewed-by: Geert Uytterhoeven Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0906FC43214 for ; Wed, 1 Sep 2021 07:13:01 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id C3545610D1 for ; Wed, 1 Sep 2021 07:13:00 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org C3545610D1 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=linux-m68k.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id D27DF6E12A; Wed, 1 Sep 2021 07:12:59 +0000 (UTC) Received: from mail-vk1-f176.google.com (mail-vk1-f176.google.com [209.85.221.176]) by gabe.freedesktop.org (Postfix) with ESMTPS id 1DE336E12A for ; Wed, 1 Sep 2021 07:12:58 +0000 (UTC) Received: by mail-vk1-f176.google.com with SMTP id k124so649559vke.5 for ; Wed, 01 Sep 2021 00:12:58 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=5OIZaaJOxzSwlBAyVUTzzSJStZdPh3eIjP+iaY26uus=; b=T8GcoEZQpWCJ/SqJDPVHfVszrar+t0waTnRjNLirfGFSpszU+ebaITwIC+/Je3Cnio P0F3xUR9ujKDVhamuastlo2OgNew7JAZEUYLPe09fieaR54NkvrLgiDChrWFpkfstkDD 26ddIBwFVEANoZW7DOq64kIgJfeyuT1aoyFKetNHHC/sCZh0HgRh3S12ejEJl2v+X7CO gHEFahQ2iUlcc7lLOiJ1z/tFZO/gQln8xhWQlFeEn1173LjxRe7IvbH3yy+R2LFkQNoP cVokXjpB7KieX3N3dKh/wq7LD+Yu9pBKMkaqu7X5YdohQaMKmzbM7NNWIej9r8qP8a6v XJyQ== X-Gm-Message-State: AOAM532FiSAdiJTwBWOhqra8AJlJr5QaNTNLioJn5IokGjqaP6OMSAHi M3n2iWXyefYINBrP1WEpIoAPRXOE9jNKjsyAPao= X-Google-Smtp-Source: ABdhPJwQRLNOZObA78mZsGR2waDSEdFHfN+IPMckzWjh/Ic7JlwZtxoUt2HD8opLWAKvAPdjb/g3GaV+9/HP/TK9CG8= X-Received: by 2002:a1f:2c97:: with SMTP id s145mr20725423vks.24.1630480377050; Wed, 01 Sep 2021 00:12:57 -0700 (PDT) MIME-Version: 1.0 References: <000000000000815b9605c70e74f8@google.com> <131b24e5-ee31-6f7b-42b4-c34583711913@infradead.org> <2fccb5d3-191c-924e-159f-1c9d423e282f@i-love.sakura.ne.jp> <339bfb21-8e80-c7d9-46dd-c416f87c50c0@infradead.org> <535e404d-03bf-8e7a-b296-132a2a98c599@i-love.sakura.ne.jp> <5c6d2b95-31d7-0d59-5e62-2593d9a0e1fe@i-love.sakura.ne.jp> <750ed1ae-de80-b232-4aea-79d60c212fab@i-love.sakura.ne.jp> In-Reply-To: <750ed1ae-de80-b232-4aea-79d60c212fab@i-love.sakura.ne.jp> From: Geert Uytterhoeven Date: Wed, 1 Sep 2021 09:12:45 +0200 Message-ID: Subject: Re: [PATCH v2] fbmem: don't allow too huge resolutions To: Tetsuo Handa Cc: Daniel Vetter , syzbot , Andrew Morton , Bartlomiej Zolnierkiewicz , Colin King , DRI Development , Linux Fbdev development list , Linux Kernel Mailing List , Masahiro Yamada , syzkaller-bugs , Randy Dunlap Content-Type: text/plain; charset="UTF-8" X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" On Wed, Sep 1, 2021 at 3:15 AM Tetsuo Handa wrote: > syzbot is reporting page fault at vga16fb_fillrect() [1], for > vga16fb_check_var() is failing to detect multiplication overflow. > > if (vxres * vyres > maxmem) { > vyres = maxmem / vxres; > if (vyres < yres) > return -ENOMEM; > } > > Since no module would accept too huge resolutions where multiplication > overflow happens, let's reject in the common path. > > Link: https://syzkaller.appspot.com/bug?extid=04168c8063cfdde1db5e [1] > Reported-by: syzbot > Debugged-by: Randy Dunlap > Signed-off-by: Tetsuo Handa Reviewed-by: Geert Uytterhoeven Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds