From patchwork Tue Mar 3 15:31:38 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Quentin Casasnovas X-Patchwork-Id: 5924001 Return-Path: X-Original-To: patchwork-linux-btrfs@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 8EA3E9F36A for ; Tue, 3 Mar 2015 15:36:14 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id BD432203B1 for ; Tue, 3 Mar 2015 15:36:13 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D1CE9203AF for ; Tue, 3 Mar 2015 15:36:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756730AbbCCPaE (ORCPT ); Tue, 3 Mar 2015 10:30:04 -0500 Received: from aserp1040.oracle.com ([141.146.126.69]:42915 "EHLO aserp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756622AbbCCPaC (ORCPT ); Tue, 3 Mar 2015 10:30:02 -0500 Received: from acsinet21.oracle.com (acsinet21.oracle.com [141.146.126.237]) by aserp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id t23FTtbZ000338 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 3 Mar 2015 15:29:56 GMT Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by acsinet21.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id t23FTtOA011106 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 3 Mar 2015 15:29:55 GMT Received: from abhmp0015.oracle.com (abhmp0015.oracle.com [141.146.116.21]) by aserv0121.oracle.com (8.13.8/8.13.8) with ESMTP id t23FTsdH002921; Tue, 3 Mar 2015 15:29:54 GMT Received: from chrystal.uk.oracle.com (/10.175.219.67) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 03 Mar 2015 07:29:49 -0800 From: Quentin Casasnovas To: linux-btrfs@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Mark Fasheh , Chris Mason , David Sterba , Quentin Casasnovas Subject: [PATCH] Btrfs:__add_inode_ref: out of bounds memory read when looking for extended ref. Date: Tue, 3 Mar 2015 16:31:38 +0100 Message-Id: <1425396698-31009-1-git-send-email-quentin.casasnovas@oracle.com> X-Mailer: git-send-email 2.0.5 In-Reply-To: <1425396236.29552.2@mail.thefacebook.com> References: <1425396236.29552.2@mail.thefacebook.com> X-Source-IP: acsinet21.oracle.com [141.146.126.237] Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@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=unavailable 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 Improper arithmetics when calculting the address of the extended ref could lead to an out of bounds memory read and kernel panic. Signed-off-by: Quentin Casasnovas Reviewed-by: David Sterba --- fs/btrfs/tree-log.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git fs/btrfs/tree-log.c fs/btrfs/tree-log.c index 9a37f8b..c5b8ba3 100644 --- fs/btrfs/tree-log.c +++ fs/btrfs/tree-log.c @@ -1012,7 +1012,7 @@ again: base = btrfs_item_ptr_offset(leaf, path->slots[0]); while (cur_offset < item_size) { - extref = (struct btrfs_inode_extref *)base + cur_offset; + extref = (struct btrfs_inode_extref *)(base + cur_offset); victim_name_len = btrfs_inode_extref_name_len(leaf, extref);