From patchwork Sat Mar 20 11:24:15 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Carpenter X-Patchwork-Id: 87096 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o2KBOl8t004842 for ; Sat, 20 Mar 2010 11:24:47 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751799Ab0CTLY1 (ORCPT ); Sat, 20 Mar 2010 07:24:27 -0400 Received: from mail-bw0-f209.google.com ([209.85.218.209]:34531 "EHLO mail-bw0-f209.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751600Ab0CTLY0 (ORCPT ); Sat, 20 Mar 2010 07:24:26 -0400 Received: by bwz1 with SMTP id 1so659844bwz.21 for ; Sat, 20 Mar 2010 04:24:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:date:from:to:cc:subject :message-id:mail-followup-to:mime-version:content-type :content-disposition:user-agent; bh=VgQYeqVwPYkn+KckmPX9GFSyYQ9CaLtGcye03Z7a9dc=; b=Kw09GLbx1gD5odM1Cdm6zMUO7U4xXDWbjc7NLoYSG43yRChRogdZTm7BTFgyZY451n 5PE0I+sAqFUGb+rz59ersHkM3nYPy3unVQXPWcdwhQ5N1aQ+Wwt/NlAkRyYBRrdzn/C5 HptDbhxUhzuo4U3U7fC3ZSEpeD6x8Q9Rfc4qA= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=date:from:to:cc:subject:message-id:mail-followup-to:mime-version :content-type:content-disposition:user-agent; b=TCx+b9AT6AiObAIxP/p2165O06IqCyx14vOCQXx7XIwgWyRwZBNVbOaQZkZtTtb1PY CcK1fxUk+dM07UJUsXQtxSV/s5DTxS/qB7Swvw0A8oU7lGH3x/EZ6jTJGiCT6XIkY9ld cStoPTTGqf7bTNg3z4TU1GLSy686Eg0BsmqN8= Received: by 10.204.134.70 with SMTP id i6mr486143bkt.74.1269084264110; Sat, 20 Mar 2010 04:24:24 -0700 (PDT) Received: from bicker ([196.43.68.220]) by mx.google.com with ESMTPS id g18sm9005358bkw.19.2010.03.20.04.24.20 (version=TLSv1/SSLv3 cipher=RC4-MD5); Sat, 20 Mar 2010 04:24:23 -0700 (PDT) Date: Sat, 20 Mar 2010 14:24:15 +0300 From: Dan Carpenter To: Chris Mason Cc: Yan Zheng , Josef Bacik , Sage Weil , Al Viro , linux-btrfs@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: [patch 2/3] btrfs: handle kmalloc() failure Message-ID: <20100320112415.GW5331@bicker> Mail-Followup-To: Dan Carpenter , Chris Mason , Yan Zheng , Josef Bacik , Sage Weil , Al Viro , linux-btrfs@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.18 (2008-05-17) Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Sat, 20 Mar 2010 11:24:48 +0000 (UTC) diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c index 15f661d..be9b5df 100644 --- a/fs/btrfs/ioctl.c +++ b/fs/btrfs/ioctl.c @@ -1212,6 +1212,9 @@ static noinline int btrfs_ioctl_ino_lookup(struct file *file, return -EPERM; args = kmalloc(sizeof(*args), GFP_KERNEL); + if (!args) + return -ENOMEM; + if (copy_from_user(args, argp, sizeof(*args))) { kfree(args); return -EFAULT;