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=-2.2 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=no 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 0D152C43215 for ; Fri, 22 Nov 2019 13:38:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id E336E20730 for ; Fri, 22 Nov 2019 13:38:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728033AbfKVNik (ORCPT ); Fri, 22 Nov 2019 08:38:40 -0500 Received: from verein.lst.de ([213.95.11.211]:52055 "EHLO verein.lst.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727166AbfKVNik (ORCPT ); Fri, 22 Nov 2019 08:38:40 -0500 Received: by verein.lst.de (Postfix, from userid 2407) id 0382B68C4E; Fri, 22 Nov 2019 14:38:38 +0100 (CET) Date: Fri, 22 Nov 2019 14:38:37 +0100 From: Christoph Hellwig To: Carlos Maiolino Cc: linux-fsdevel@vger.kernel.org, hch@lst.de, darrick.wong@oracle.com, sandeen@sandeen.net Subject: Re: [PATCH 5/5] fibmap: Reject negative block numbers Message-ID: <20191122133837.GD25822@lst.de> References: <20191122085320.124560-1-cmaiolino@redhat.com> <20191122085320.124560-6-cmaiolino@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20191122085320.124560-6-cmaiolino@redhat.com> User-Agent: Mutt/1.5.17 (2007-11-01) Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org On Fri, Nov 22, 2019 at 09:53:20AM +0100, Carlos Maiolino wrote: > FIBMAP receives an integer from userspace which is then implicitly converted > into sector_t to be passed to bmap(). No check is made to ensure userspace > didn't send a negative block number, which can end up in an underflow, and > returning to userspace a corrupted block address. > > As a side-effect, the underflow caused by a negative block here, will > trigger the WARN() in iomap_bmap_actor(), which is how this issue was > first discovered. > > This is essentially a V2 of a patch I sent a while ago, reworded and > refactored to fit into this patchset. That last sentence should probably be removed. Otherwise: Reviewed-by: Christoph Hellwig