From patchwork Mon Jan 13 13:23:07 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Carpenter X-Patchwork-Id: 11330183 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 04F43921 for ; Mon, 13 Jan 2020 13:23:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D69152084D for ; Mon, 13 Jan 2020 13:23:55 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=oracle.com header.i=@oracle.com header.b="alF88qWn" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726505AbgAMNXz (ORCPT ); Mon, 13 Jan 2020 08:23:55 -0500 Received: from userp2120.oracle.com ([156.151.31.85]:39564 "EHLO userp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726277AbgAMNXz (ORCPT ); Mon, 13 Jan 2020 08:23:55 -0500 Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.27/8.16.0.27) with SMTP id 00DDMe1h091442; Mon, 13 Jan 2020 13:23:49 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-2019-08-05; bh=8OZxeanEuptXF8CJ0FdPIwRdmEuBYU+V1UcaAab/WP4=; b=alF88qWnhtZBwRxjsDU+LhxfvFBhR8wdyI+nL8HIQYD7YOU859JkAYSrHQFjj3fsenhd XvPaAPm2M7lQmDJKzhHQtmJcZzU8HvquwNQFO6ASTQea2tmtMERPad/lnnUnovDK0SVW neiRQhgdgYq8tMOQ3YH32A8NztpVVb+TyB4xooUMO/CcaRXMZm/G9hQjxPzAQ5q8K389 4RRFtevsA63LWAKWJDgaRdYI02HNCkTkroVM9aVRul7jC9LEGlzeVDtqAbFzuZUJA1cZ H/85nOqumdRDi9bX1Jhj9Bjh8aN0decsUWpzmsS9aUw1Svn+k8sXnnlgfaR0HT89oRdE AQ== Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by userp2120.oracle.com with ESMTP id 2xf73y6vnb-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 13 Jan 2020 13:23:49 +0000 Received: from pps.filterd (userp3030.oracle.com [127.0.0.1]) by userp3030.oracle.com (8.16.0.27/8.16.0.27) with SMTP id 00DDNnvl154646; Mon, 13 Jan 2020 13:23:49 GMT Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by userp3030.oracle.com with ESMTP id 2xfqu4hufy-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 13 Jan 2020 13:23:49 +0000 Received: from abhmp0009.oracle.com (abhmp0009.oracle.com [141.146.116.15]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id 00DDNEGb024717; Mon, 13 Jan 2020 13:23:14 GMT Received: from kili.mountain (/129.205.23.165) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 13 Jan 2020 05:23:14 -0800 Date: Mon, 13 Jan 2020 16:23:07 +0300 From: Dan Carpenter To: "J. Bruce Fields" , Olga Kornievskaia Cc: Chuck Lever , linux-nfs@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: [PATCH] nfsd4: fix double free in nfsd4_do_async_copy() Message-ID: <20200113132307.frp6ur5zhzolu5ys@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=6000 definitions=9498 signatures=668685 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1911140001 definitions=main-2001130112 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9498 signatures=668685 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1911140001 definitions=main-2001130112 Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org This frees "copy->nf_src" before and again after the goto. Fixes: ce0887ac96d3 ("NFSD add nfs4 inter ssc to nfsd4_copy") Signed-off-by: Dan Carpenter Reviewed-by: Olga Kornievskaia --- fs/nfsd/nfs4proc.c | 1 - 1 file changed, 1 deletion(-) diff --git a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c index 1e14b3ed5674..c90c24c35b2e 100644 --- a/fs/nfsd/nfs4proc.c +++ b/fs/nfsd/nfs4proc.c @@ -1469,7 +1469,6 @@ static int nfsd4_do_async_copy(void *data) copy->nf_src->nf_file = nfs42_ssc_open(copy->ss_mnt, ©->c_fh, ©->stateid); if (IS_ERR(copy->nf_src->nf_file)) { - kfree(copy->nf_src); copy->nfserr = nfserr_offload_denied; nfsd4_interssc_disconnect(copy->ss_mnt); goto do_callback;