From patchwork Thu Aug 2 08:44:29 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Carpenter X-Patchwork-Id: 10553365 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9F60B13BF for ; Thu, 2 Aug 2018 08:44:45 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9018E277D9 for ; Thu, 2 Aug 2018 08:44:45 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8271929418; Thu, 2 Aug 2018 08:44:45 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2EAF5277D9 for ; Thu, 2 Aug 2018 08:44:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726794AbeHBKev (ORCPT ); Thu, 2 Aug 2018 06:34:51 -0400 Received: from userp2130.oracle.com ([156.151.31.86]:36882 "EHLO userp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726194AbeHBKev (ORCPT ); Thu, 2 Aug 2018 06:34:51 -0400 Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w728ibNZ017714; Thu, 2 Aug 2018 08:44:37 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=date : from : to : cc : subject : message-id : mime-version : content-type; s=corp-2018-07-02; bh=rDkAzndmV34pi0FmPOcUQUXdLq3r7xzgW6OqtYw8dOk=; b=WUjoEV28NtsURYBmcmMSFJKtZnp7YnyhlaVeoGyZqYuVWxXSWwUQplWUIhXgrp6y3V+M Ibgg1eCjP6P0ogExwpvdF+m7roOlvuIj50nQCG5UWn9EjbTsJyPW6Tu6gnukbCityo+W fNhgxQPfaoWV3ISYezhrlZlRs5nGBUcLI4pARG80OTiL2ugbooMUSsTKhs0jRXtXluiS 8U8tyTk7qFbSJ/14RA+AanFq6p13Ap7uQEXZdVemu2GpIdGmpLBheewOrHAfAIdx3fGX RFeAfjllusPQ7aBiPx7uom3MnUDC7TvnChmMZzD8OJNFieVoT/RGpF1ioaOla5o9xHql bQ== Received: from userv0021.oracle.com (userv0021.oracle.com [156.151.31.71]) by userp2130.oracle.com with ESMTP id 2kgfwta9sy-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 02 Aug 2018 08:44:37 +0000 Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by userv0021.oracle.com (8.14.4/8.14.4) with ESMTP id w728iaDH028239 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 2 Aug 2018 08:44:37 GMT Received: from abhmp0007.oracle.com (abhmp0007.oracle.com [141.146.116.13]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id w728iaAs028402; Thu, 2 Aug 2018 08:44:36 GMT Received: from kili.mountain (/197.232.248.111) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Thu, 02 Aug 2018 01:44:36 -0700 Date: Thu, 2 Aug 2018 11:44:29 +0300 From: Dan Carpenter To: Chris Mason , Nikolay Borisov Cc: Josef Bacik , David Sterba , linux-btrfs@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: [PATCH] btrfs: dereferencing error pointer in btrfs_quota_enable() Message-ID: <20180802084428.k2uemow7k6j3us47@kili.mountain> MIME-Version: 1.0 Content-Disposition: inline X-Mailer: git-send-email haha only kidding User-Agent: NeoMutt/20170113 (1.7.2) X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8972 signatures=668707 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=908 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1806210000 definitions=main-1808020093 Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The error handling in "goto out;" expects that if "trans" is non-NULL that means it's valid. Unfortunately it could also be an error pointer. Fixes: c9a6fe84fe43 ("btrfs: qgroups: Move transaction management inside btrfs_quota_enable/disable") Signed-off-by: Dan Carpenter Reviewed-by: Nikolay Borisov --- 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/qgroup.c b/fs/btrfs/qgroup.c index 3a9019928329..380ff978defa 100644 --- a/fs/btrfs/qgroup.c +++ b/fs/btrfs/qgroup.c @@ -904,6 +904,7 @@ int btrfs_quota_enable(struct btrfs_fs_info *fs_info) trans = btrfs_start_transaction(tree_root, 2); if (IS_ERR(trans)) { ret = PTR_ERR(trans); + trans = NULL; goto out; }