Received: by 10.213.65.68 with SMTP id h4csp53408imn; Fri, 6 Apr 2018 15:28:55 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+Evh2TGvIHa9ZqSj95TzEVaA//31cU9I/ae4gfPtqubSbfwNNPEa89F06DLxnRllkTsX/i X-Received: by 2002:a17:902:7c8b:: with SMTP id y11-v6mr24243777pll.393.1523053735290; Fri, 06 Apr 2018 15:28:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523053735; cv=none; d=google.com; s=arc-20160816; b=EnXXDfz16XNzxluZQvy6BOiXgIAjTn2KN97mqPHQF6DZesPtmR9ibgtUZc9oTbzhcT hGFU/o01szKVD+ktMxXgRWsix2x56UsU4rOpXzj5jGWgGMzLgZvkDsIHFFtkwS5ppABa je1aRYGjTkE1WU/OUrzD8Y3nGCezQ5HrB5gKj0ELN8XVpKG15byYjnqRm+OuS4+Khtgr 6FLCqVTnAlKOrXkd+wchxe2J1qE4VNY7VMOKFrLcHnGY39bPdgFTKlYNnFbpCUuMrOio 91Zb4n2TdsCEBiWg+jEW3MHTg1vHBZ8YZUJpLwXuipuUqFULyhoLiXNbtYwwQRdzALKn jEbA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=h8lm0drC7R83hNhYfiBuIRZQo0DiVrDYgMiQW7Bq51o=; b=KpN3RcfGqfvdyuXykekhbdpTNBUGCQTw+yx7U36VtTuKVOJyj0YuHqLn79P0yxqZ0u aBZ0z9Zj0jFP7I04Y/rsJoZlYU77F2NIzjqOgzgf+TOnDl3SDbCYMJhCNpYxFiCyKcax HQd1KWEJmFt0BZUQAEqr4jPnJ3SVBkEPsyLqXVis89UyHGPEM+fvAX04/pvSMTeXBWbY ZyOcvquZfrf6h5csjvpA+m08rzA7/m0s06i6mlRXasK5+/rl6R6mgxzqf9yIvtQISl5J NiIKxoBDiPEjUX0oc1ATKz5mjKBhJHbqmKgZyQfgZikBSgFDsc/SaW4e59Ve9Rscs8Hk Skhg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=qa9WJ1tH; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n6si7725294pgc.590.2018.04.06.15.28.17; Fri, 06 Apr 2018 15:28:54 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=qa9WJ1tH; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752474AbeDFWZN (ORCPT + 99 others); Fri, 6 Apr 2018 18:25:13 -0400 Received: from mail-pl0-f66.google.com ([209.85.160.66]:45602 "EHLO mail-pl0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751730AbeDFWZL (ORCPT ); Fri, 6 Apr 2018 18:25:11 -0400 Received: by mail-pl0-f66.google.com with SMTP id v18-v6so1457001ply.12 for ; Fri, 06 Apr 2018 15:25:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=h8lm0drC7R83hNhYfiBuIRZQo0DiVrDYgMiQW7Bq51o=; b=qa9WJ1tHSyJXrPalemNAUGUyoEbSR2fTCHVT8KTeS3ctArhLLyzX3X8zqqOcu7wCMy GKWFbiwBMbs1ZegqoBy83nFaMwgFm2wl//xLWIKFYGHcDAcQcn1iOQ01GvOTGcKeAinu H+Z5kIauyb9KNZz1xuE2ul5SJNS9HO95xTHyz+vgX7l7ALVjtT2KDtNUI8yibjsw9I5z kDSV8dadLD7LguIEO7hfIaG8FhAWXH/MqSZ1O5yp7EPoAQ8wboE8450iBjQASusumKtJ dcPwxsIO0GAaadvf21vAYXp9Jpb2a7dSGopTzAwYXPTzS4uxAD6wKy+cmFrovg9L+frd RH6w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=h8lm0drC7R83hNhYfiBuIRZQo0DiVrDYgMiQW7Bq51o=; b=sAaNVhyfJpB8xAo8tQG+HRu5DxbO1LP25G3LYBFagBZL7iU9Sxm5hWtpU0LQ9Kb3BE UqS5z50ni98USpJzSrUPhJ9yWnlhGkCbt0GjnYfD1L01ddGIixdz0Dhw6cDy7jiwKNSh FOm3beIXHxiDXDUJ5SP0IiPlnbxy/9Pyb7XX1JB7QyM14hdZ82LedtXAGyGQz0PHvbOb RuJCDs+lKnAZwkC4jvbHoK0WlvdPzHoJ7HruyHr0gs+d+Ly7tAlT3kBVnUYAM0kHoyF/ VjA6jXA5uGanEVvmpywF9HlBN2fzPlAoe9HxLsmfk29RTS2C/m6Fyoe3GRV2Y2GM6OHz aQ5Q== X-Gm-Message-State: AElRT7E9hI9fNGa9Xx+DaF8DjexFgfcXp5iCJ1cmjamYzNEl2e8WRwae Qtv/E/OH/RgLPJ1ET/hAmNDlj7umwJw= X-Received: by 2002:a17:902:4d45:: with SMTP id o5-v6mr29900902plh.84.1523053510839; Fri, 06 Apr 2018 15:25:10 -0700 (PDT) Received: from khazhy.svl.corp.google.com ([2620:15c:2cd:203:478f:57ef:e0f2:999d]) by smtp.gmail.com with ESMTPSA id b73sm19190466pga.62.2018.04.06.15.25.09 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 06 Apr 2018 15:25:09 -0700 (PDT) From: Khazhismel Kumykov To: axboe@kernel.dk Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, Khazhismel Kumykov Subject: [PATCH] block/compat_ioctl: fix range check in BLKGETSIZE Date: Fri, 6 Apr 2018 15:23:50 -0700 Message-Id: <20180406222350.174104-1-khazhy@google.com> X-Mailer: git-send-email 2.17.0.484.g0c8726318c-goog Content-Type: multipart/signed; protocol="application/pkcs7-signature"; micalg=sha-256; boundary="00000000000083185e056935872f" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --00000000000083185e056935872f kernel ulong and compat_ulong_t may not be same width. Use type directly to eliminate mismatches. This would result in truncation rather than EFBIG for 32bit mode for large disks. Signed-off-by: Khazhismel Kumykov --- block/compat_ioctl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/block/compat_ioctl.c b/block/compat_ioctl.c index 6ca015f92766..3a2c77f07da8 100644 --- a/block/compat_ioctl.c +++ b/block/compat_ioctl.c @@ -388,7 +388,7 @@ long compat_blkdev_ioctl(struct file *file, unsigned cmd, unsigned long arg) return 0; case BLKGETSIZE: size = i_size_read(bdev->bd_inode); - if ((size >> 9) > ~0UL) + if ((size >> 9) > ~((compat_ulong_t)0UL)) return -EFBIG; return compat_put_ulong(arg, size >> 9); -- 2.17.0.484.g0c8726318c-goog --00000000000083185e056935872f Content-Type: application/pkcs7-signature; name="smime.p7s" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="smime.p7s" Content-Description: S/MIME Cryptographic Signature MIIS5wYJKoZIhvcNAQcCoIIS2DCCEtQCAQExDzANBglghkgBZQMEAgEFADALBgkqhkiG9w0BBwGg ghBNMIIEXDCCA0SgAwIBAgIOSBtqDm4P/739RPqw/wcwDQYJKoZIhvcNAQELBQAwZDELMAkGA1UE BhMCQkUxGTAXBgNVBAoTEEdsb2Jh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