From patchwork Fri Apr 19 01:04:46 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tsutomu Itoh X-Patchwork-Id: 2462931 Return-Path: X-Original-To: patchwork-linux-btrfs@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id D21363FCA5 for ; Fri, 19 Apr 2013 01:05:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S967375Ab3DSBFK (ORCPT ); Thu, 18 Apr 2013 21:05:10 -0400 Received: from fgwmail5.fujitsu.co.jp ([192.51.44.35]:60609 "EHLO fgwmail5.fujitsu.co.jp" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S966825Ab3DSBFJ (ORCPT ); Thu, 18 Apr 2013 21:05:09 -0400 Received: from m1.gw.fujitsu.co.jp (unknown [10.0.50.71]) by fgwmail5.fujitsu.co.jp (Postfix) with ESMTP id 9125D3EE0C1 for ; Fri, 19 Apr 2013 10:05:06 +0900 (JST) Received: from smail (m1 [127.0.0.1]) by outgoing.m1.gw.fujitsu.co.jp (Postfix) with ESMTP id 79D9845DE55 for ; Fri, 19 Apr 2013 10:05:06 +0900 (JST) Received: from s1.gw.fujitsu.co.jp (s1.gw.fujitsu.co.jp [10.0.50.91]) by m1.gw.fujitsu.co.jp (Postfix) with ESMTP id 6197845DE58 for ; Fri, 19 Apr 2013 10:05:06 +0900 (JST) Received: from s1.gw.fujitsu.co.jp (localhost.localdomain [127.0.0.1]) by s1.gw.fujitsu.co.jp (Postfix) with ESMTP id 52FEE1DB8032 for ; Fri, 19 Apr 2013 10:05:06 +0900 (JST) Received: from ml14.s.css.fujitsu.com (ml14.s.css.fujitsu.com [10.240.81.134]) by s1.gw.fujitsu.co.jp (Postfix) with ESMTP id 0BD551DB8049 for ; Fri, 19 Apr 2013 10:05:06 +0900 (JST) Received: from ml14.css.fujitsu.com (ml14 [127.0.0.1]) by ml14.s.css.fujitsu.com (Postfix) with ESMTP id D61059F7DA0 for ; Fri, 19 Apr 2013 10:05:05 +0900 (JST) Received: from FM-323941448.jp.fujitsu.com (unknown [10.124.101.132]) by ml14.s.css.fujitsu.com (Postfix) with SMTP id 694399F7DC4 for ; Fri, 19 Apr 2013 10:05:05 +0900 (JST) X-SecurityPolicyCheck: OK by SHieldMailChecker v1.7.4 Message-Id: <201304190104.AA00029@FM-323941448.jp.fujitsu.com> From: Tsutomu Itoh Date: Fri, 19 Apr 2013 10:04:46 +0900 To: linux-btrfs@vger.kernel.org Subject: [PATCH] Btrfs: fix error handling in btrfs_ioctl_send() MIME-Version: 1.0 X-Mailer: AL-Mail32 Version 1.13 Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org fget() returns NULL if error. So, we should check NULL or not. Signed-off-by: Tsutomu Itoh --- fs/btrfs/send.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/fs/btrfs/send.c b/fs/btrfs/send.c index 96a826a..f892e0e 100644 --- a/fs/btrfs/send.c +++ b/fs/btrfs/send.c @@ -4610,8 +4610,8 @@ long btrfs_ioctl_send(struct file *mnt_file, void __user *arg_) sctx->flags = arg->flags; sctx->send_filp = fget(arg->send_fd); - if (IS_ERR(sctx->send_filp)) { - ret = PTR_ERR(sctx->send_filp); + if (!sctx->send_filp) { + ret = -EBADF; goto out; }