Received: by 2002:a05:6358:5282:b0:b5:90e7:25cb with SMTP id g2csp2460806rwa; Mon, 22 Aug 2022 08:05:50 -0700 (PDT) X-Google-Smtp-Source: AA6agR6M9u2v/O4EAsCbIVUpcna2aPbH3dYDsTnjd4tUveIA2+ooTnF0rnuT7ccpugLQfc52PWxM X-Received: by 2002:a17:907:6da1:b0:731:6a7a:83c0 with SMTP id sb33-20020a1709076da100b007316a7a83c0mr13407319ejc.473.1661180750248; Mon, 22 Aug 2022 08:05:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661180750; cv=none; d=google.com; s=arc-20160816; b=n/62365GHVK6QKLeFzdRqjWEpO/0yoXaRBG8no1ZK0T7DP47FyM9DAnqD2UnFrqB+e qXKIykHn/RhOx4P4AT8mB2rm/e/Ya/Ou1c5ZO6zRKgQkx0jC9wvv/wgmmqzN/haltH/x k748tOmQhqTd0IO8yHdw7bk0rzNXD+tFpcz96oeglDOw3+1I/0DvTkdTOGMyyiOmHSFb vrX72R7jJKPi95SMr0aUlQ4sjtvWZdsNiOH+JxKOgJy7tPU3T+Ec2BXC7d378FkTOi0x aQBjGzfG351UrT8MuBb7fGcXhlMujP3Y9pKZoAzF/Iv2oDa0kgJGEK2rA3XC6+3FSebG Kikw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=q5YRa5+mq/HwCfXcY5+pkEQiG+nbfa6Rah54AG40jI4=; b=ORNcOD9rdUiHPVyE6vg1uX9Ksh0kCKmhrg9dovUHHvh5YXavgLhaemoGS/Gj1F8aBy VY3O4rdkYjUeJaQxCAnQwkFiXcmbzguRZj5tXkpvt6ZNhi7ubd7G1Ja6g7s6Ets4i5G9 gnKxM3aMMzOCzfTUrhF28y0wv5h2Tl09iBr8F/v1DHZPziRuA2PkRU9JzK52pZg7NqyD a/RZBjX3oo2t+9AiHNwYZuvczZUqeGJ6x0UzfsFqFlklTiCQEgYRDU5HZeMRvFJvErTK ZD8XjDrH1suI5Wq3H02qMqRKwwXlirH2jnOSZkviH1Mdt79wA6EQykipiAh7xaPG37dr TizQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=stK85MZ2; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id sc26-20020a1709078a1a00b00730c3a98892si9893593ejc.978.2022.08.22.08.05.24; Mon, 22 Aug 2022 08:05:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=stK85MZ2; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235557AbiHVOwo (ORCPT + 99 others); Mon, 22 Aug 2022 10:52:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41526 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235556AbiHVOwj (ORCPT ); Mon, 22 Aug 2022 10:52:39 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9EEF737FBA; Mon, 22 Aug 2022 07:52:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=q5YRa5+mq/HwCfXcY5+pkEQiG+nbfa6Rah54AG40jI4=; b=stK85MZ2ZxRVqduD/jsKgbVjWq fxMI/8GkUln+m14de7UQl6oqrfyJlcAbjEBU+Ju5VOzsMUAFKdFU+o/OCf8xV5pG7f0gi4e6AKFbu fLngfUjXEEadukEUN6o25JzDGxhapPVbWcOkBC1XafjYjesERaDmOEDN9s8PIwc4vVuA25DiW2NMF i70XuESPmNsqviWsqxnjtiSjnLl/wpg3rO/kudU/n4GVcV1Ry30WsLsOYr9NuJBW7d3LKPbAAgtRi BhhkPorelqKALGQ2pALVgEwTWVwkFe/23vbOJqj6U4SNgd7UKyEs62d8LxCNcZSxkkZbj4/86avey 1J2sLZ5A==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1oQ8n2-00EN3D-GF; Mon, 22 Aug 2022 14:52:32 +0000 Date: Mon, 22 Aug 2022 15:52:32 +0100 From: Matthew Wilcox To: Siddh Raman Pant Cc: david , djwong , fgheet255t , hch , linux-ext4 , linux-fsdevel , linux-kernel , linux-xfs , riteshh , syzbot+a8e049cd3abd342936b6 , syzkaller-bugs Subject: Re: [syzbot] WARNING in iomap_iter Message-ID: References: <182c028abf0.2dc6f7c973088.2963173753499991828@siddh.me> <20220821114816.24193-1-code@siddh.me> <182c607e79a.820e4a7012709.6365464609772129416@siddh.me> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <182c607e79a.820e4a7012709.6365464609772129416@siddh.me> X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org On Mon, Aug 22, 2022 at 08:19:43PM +0530, Siddh Raman Pant wrote: > On Mon, 22 Aug 2022 20:15:28 +0530 Matthew Wilcox wrote: > > On Sun, Aug 21, 2022 at 05:18:16PM +0530, Siddh Raman Pant wrote: > > > @@ -979,9 +979,15 @@ loop_set_status_from_info(struct loop_device *lo, > > > > > > lo->lo_offset = info->lo_offset; > > > lo->lo_sizelimit = info->lo_sizelimit; > > > + lo->lo_flags = info->lo_flags; > > > + > > > + /* loff_t/int vars are assigned __u64/__u32 vars (respectively) */ > > > + if (lo->lo_offset < 0 || lo->lo_sizelimit < 0 || lo->lo_flags < 0) > > > + return -EOVERFLOW; > > > > Why would you check lo_flags? That really, really should be an unsigned > > type. > > I agree, but the loop_device struct has (see line 54 of loop.c): > int lo_flags; > > Thus, I checked for it, as we are not changing any types. But it's not an integer. It's a bitfield. Nobody checks lo_flags for "is it less than zero". That makes it very different from lo_offset.