From patchwork Tue Dec 15 15:38:22 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bart Van Assche X-Patchwork-Id: 7855561 Return-Path: X-Original-To: patchwork-linux-block@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 725FEBEEE1 for ; Tue, 15 Dec 2015 15:53:12 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 8F110202FE for ; Tue, 15 Dec 2015 15:53:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B18632028D for ; Tue, 15 Dec 2015 15:53:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753884AbbLOPxF (ORCPT ); Tue, 15 Dec 2015 10:53:05 -0500 Received: from mail-bl2on0070.outbound.protection.outlook.com ([65.55.169.70]:53184 "EHLO na01-bl2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753821AbbLOPxA (ORCPT ); Tue, 15 Dec 2015 10:53:00 -0500 X-Greylist: delayed 471 seconds by postgrey-1.27 at vger.kernel.org; Tue, 15 Dec 2015 10:52:59 EST Received: from BLUPR02CA038.namprd02.prod.outlook.com (10.160.23.156) by DM2PR02MB301.namprd02.prod.outlook.com (10.141.83.140) with Microsoft SMTP Server (TLS) id 15.1.355.16; Tue, 15 Dec 2015 15:38:30 +0000 Received: from BL2FFO11FD041.protection.gbl (2a01:111:f400:7c09::131) by BLUPR02CA038.outlook.office365.com (2a01:111:e400:8ad::28) with Microsoft SMTP Server (TLS) id 15.1.355.16 via Frontend Transport; Tue, 15 Dec 2015 15:38:30 +0000 Authentication-Results: spf=pass (sender IP is 63.163.107.173) smtp.mailfrom=sandisk.com; suse.cz; dkim=none (message not signed) header.d=none;suse.cz; dmarc=bestguesspass action=none header.from=sandisk.com; Received-SPF: Pass (protection.outlook.com: domain of sandisk.com designates 63.163.107.173 as permitted sender) receiver=protection.outlook.com; client-ip=63.163.107.173; helo=milsmgep12.sandisk.com; Received: from milsmgep12.sandisk.com (63.163.107.173) by BL2FFO11FD041.mail.protection.outlook.com (10.173.161.137) with Microsoft SMTP Server id 15.1.346.13 via Frontend Transport; Tue, 15 Dec 2015 15:38:26 +0000 Received: from MILHUBIP03.sdcorp.global.sandisk.com ( [172.22.12.162]) by milsmgep12.sandisk.com (Symantec Messaging Gateway) with SMTP id D2.01.32178.1F330765; Tue, 15 Dec 2015 07:38:25 -0800 (PST) Received: from milsmgip11.sandisk.com (10.177.8.100) by MILHUBIP03.sdcorp.global.sandisk.com (10.177.9.96) with Microsoft SMTP Server id 14.3.248.2; Tue, 15 Dec 2015 07:38:25 -0800 X-AuditID: ac160a69-f79f76d000007db2-9d-567033f1ffe2 Received: from [10.50.231.65] ( [10.177.8.100]) by milsmgip11.sandisk.com (Symantec Messaging Gateway) with SMTP id 34.18.15370.FE330765; Tue, 15 Dec 2015 07:38:24 -0800 (PST) To: Jens Axboe CC: Jan Kara , Christoph Hellwig , Robert Elliot , From: Bart Van Assche Subject: [PATCH] brd: Fix discard request processing Message-ID: <567033EE.7010708@sandisk.com> Date: Tue, 15 Dec 2015 16:38:22 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.4.0 MIME-Version: 1.0 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrJLMWRmVeSWpSXmKPExsWyRoxnke5H44Iwg3lbWCz+7znGZrFk1TZW i5WrjzJZzJ7ezGSx95a2A6vHxOZ37B67tu1k8th9s4HN48yCI+wenzfJBbBGcdmkpOZklqUW 6dslcGUsv/aLsWAaR8X5k0uYGhjvsnUxcnJICJhILFn9gxnCFpO4cG89UJyLQ0jgBKNE19Q3 j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qbWQ4zJOv3rW9YnD XTNh5auefSe2WbwMvrqc9fmLxZ6XT81cZGVUYpInwPoutYpF8nAr09IECdv9zn+k5M8vWs76 iqm+P9rmSlXfLo+N79oefkjcqcRSnJFoqMVcVJwIAP9JNG7zAQAA X-EOPAttributedMessage: 0 X-Microsoft-Exchange-Diagnostics: 1; BL2FFO11FD041; 1:ND3aR1/xjDdkJSnCQ8M2PAvvB7vabuyGNaH7qf7enYDknMGT2nYgl37gwGm8kKcGGBj9/dtCV7gaD1U6Fv3vNSfAZBqg0FIETKDcdXaWcbixZnmhtfJuUvGVPkoDxukeaWhm21uwSnwGT9k1H5gtMXdP/Ut4ad11+6CJJYVuLm1Rm/tIUOw+YpoGIB7sZDL+6i8OR6TJuArjWWqnjM9wSqf1cJ/IjtqXtEzhLa1+m6IwbMEB1lfaRDX/UXhSTqrn//YWSczbkBc64+vJxUlIlX9Wz4Z66jK5m9tzmWkupngSHiuDkOhC+5wzKi5rRKGDF7HKGGht2woU31Fp0LmU/n4EklnxTb4ei5Ji8+88BTWzT1SOIUbgJL7VfTS11PpIVligY8hBqHwKTdj2kNiNuWVQr/JG3WFgGkuY6IzucJw= X-Forefront-Antispam-Report: CIP:63.163.107.173; CTRY:US; IPV:NLI; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(2980300002)(438002)(199003)(189002)(87266999)(50986999)(19580405001)(5001960100002)(230700001)(106466001)(80316001)(19580395003)(65816999)(69596002)(81156007)(110136002)(59896002)(92566002)(5008740100001)(54356999)(4001350100001)(83506001)(77096005)(64126003)(86362001)(87936001)(47776003)(65806001)(65956001)(97736004)(50466002)(586003)(99136001)(33656002)(23676002)(1220700001)(229853001)(1096002)(36756003)(11100500001)(189998001)(7059030); DIR:OUT; SFP:1101; SCL:1; SRVR:DM2PR02MB301; H:milsmgep12.sandisk.com; FPR:; SPF:Pass; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; DM2PR02MB301; 2:IedO3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yenubkuOsG/XOfQ/f6l4LycZj+1F1KdV77KPkEudIci1c0cllCT+H7PRk2tMumOJgqalq5xbfeQLFW1xZPqXxntix0sQssqt6yzWqLVkkfAdi6m2EjTc1HhD5zE5mqojCZXOlc2Jl/epKQkFLYCdJxEJaMHoAjBH871PDDJnSYo08ZBpPVLONZ7vOI0b2zSh1w3Ra/wYnOxjCeTtvpaFnFXhkpVvSpETiLnvSmhnwPIqRYHIQXlOCKmW06 X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(42932892334569)(73583498263828); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(520078)(5005006)(8121501046)(3002001)(10201501046); SRVR:DM2PR02MB301; BCL:0; PCL:0; RULEID:; SRVR:DM2PR02MB301; X-Microsoft-Exchange-Diagnostics: 1; DM2PR02MB301; 4:f4psKsSAFCK4bzwXlS5ABpQErmwm3rrwFdGN2dMbjeyZdkeBg1UcQzrFVMbmeErHgJLmbP2aB7c2ASotgKhJg+bfndOINH2Q59Aq7ZrOzhuDm8kp9J7IMSGXJ2VJ6KIgGyeGvwxjainTLIdVsdB7Hlzk6d+TjPEncASsVC4+4xw5r1Bxg5pnCz13FolKorF5i9KEKeM1FrelpCd0G9UuBn5x1jHknmMkvMiqHR3Q2NS9NalHOnGlqGahpC0ZXQZxMRhq/wEIw4u7YjC3gKyTGF3qR5kfqB5zIkeSfQxY7hGhn3Mbfy7c6VbbTf3cfytJ1eIobZMcXyumAPHqTq2zdT5DX/JcDubp0Fnzvy+uRGsPeNUbZsitOne8fswxVcZKEUQRHQ4e+7chTT3y3tUn7Fpny31/QvWyXHrmI4fkJGAtsNra7Gxa2Sulx1LZbvCGupUp62uNOi9fP99hXmhEDQ== X-Forefront-PRVS: 07915F544A X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtETTJQUjAyTUIzMDE7MjM6YkFTRE1kSHdBNWlvWkdFZzdOUDhad0dwUlZl?= =?utf-8?B?b24xb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msG63vUdqDTDjmqLI9RFyYsXKUyQwKZIZNcSxWscJCCaqF0Xq0uBcBUr3aHDt04eLFQPyf2YwKuKwMKHMeFeczC95Km2wvm6NGrDzO0CalTVpY4JW/+VPf6mb1Znl4e1HwjVHmGQOwVb3BbciI4t/qEWTiRzeUcr6OBzrOfLbK2nNNXI6wixnIJuY SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: sandisk.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Dec 2015 15:38:26.7653 (UTC) X-MS-Exchange-CrossTenant-Id: fcd9ea9c-ae8c-460c-ab3c-3db42d7ac64d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=fcd9ea9c-ae8c-460c-ab3c-3db42d7ac64d; Ip=[63.163.107.173]; Helo=[milsmgep12.sandisk.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM2PR02MB301 Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Avoid that discard requests with size => PAGE_SIZE fail with -EIO. Refuse discard requests if the discard size is not a multiple of the page size. Fixes: 2dbe54957636 ("brd: Refuse improperly aligned discard requests") Signed-off-by: Bart Van Assche Cc: Jan Kara Cc: Christoph Hellwig Cc: Robert Elliot Cc: stable # v4.4+ Reviewed-by: Jan Kara --- drivers/block/brd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/block/brd.c b/drivers/block/brd.c index a5880f4..1914c63 100644 --- a/drivers/block/brd.c +++ b/drivers/block/brd.c @@ -338,7 +338,7 @@ static blk_qc_t brd_make_request(struct request_queue *q, struct bio *bio) if (unlikely(bio->bi_rw & REQ_DISCARD)) { if (sector & ((PAGE_SIZE >> SECTOR_SHIFT) - 1) || - bio->bi_iter.bi_size & PAGE_MASK) + bio->bi_iter.bi_size & ~PAGE_MASK) goto io_error; discard_from_brd(brd, sector, bio->bi_iter.bi_size); goto out;