From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.1 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 00CF5C169C4 for ; Thu, 31 Jan 2019 13:03:09 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A4E1A20881 for ; Thu, 31 Jan 2019 13:03:08 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=paulo.ac header.i=@paulo.ac header.b="fybv8WNQ"; dkim=pass (1024-bit key) header.d=paulo.ac header.i=@paulo.ac header.b="hXhSQ9Bg" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1733098AbfAaNDI (ORCPT ); Thu, 31 Jan 2019 08:03:08 -0500 Received: from mail.paulo.ac ([18.228.144.36]:63012 "EHLO mail.paulo.ac" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732877AbfAaNDI (ORCPT ); Thu, 31 Jan 2019 08:03:08 -0500 X-Greylist: delayed 591 seconds by postgrey-1.27 at vger.kernel.org; Thu, 31 Jan 2019 08:03:07 EST Received: from localhost (localhost [127.0.0.1]) by mail.paulo.ac (Postfix) with ESMTP id 5D23348DAFEF; Thu, 31 Jan 2019 12:53:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=paulo.ac; s=default; t=1548939195; bh=rz0kKaT6BSXzCfe7R0vtYpUCqI4zs5NM+3PXk2pLCq0=; h=From:To:Cc:Subject:In-Reply-To:References:Date; b=fybv8WNQeeUOBeAsFbpuu23Ca7ywOBsjExyy+Q9wlxyvAxS2K3NCtx73MYMReKF0x DpSCElqw9/06wCphFa6jboC2SDtB8xnQrjdhc3gJXM4okd2VmBmz5LG0CFTP99ZDfp vnz37px74DXAzIzE176W31gXrvxJEInv3IlZXtM8= Received: from mail.paulo.ac ([127.0.0.1]) by localhost (ip-172-31-5-70.sa-east-1.compute.internal [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id GbVnNrU5F5pd; Thu, 31 Jan 2019 12:53:14 +0000 (UTC) Received: from localhost (unknown [201.86.214.237]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.paulo.ac (Postfix) with ESMTPSA id 5E0A648DAFEE; Thu, 31 Jan 2019 12:53:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=paulo.ac; s=default; t=1548939194; bh=rz0kKaT6BSXzCfe7R0vtYpUCqI4zs5NM+3PXk2pLCq0=; h=From:To:Cc:Subject:In-Reply-To:References:Date; b=hXhSQ9Bg8kjdALJ/4ujZB/UL/FdcGOaQgrJRq4P138kpcDehfdEw92sI5AZzUOzVv ZW9pcNvic55r448bCxX6yeSJ3C0nhUrNQ1LlzOOK+hgb+PZE+NmjhCDt04MWTlmnMF Mfdk2B87v29jt2QLvnp7RtidfCuS4UmYa6KcUEAY= From: Paulo Alcantara To: Aurelien Aptel , linux-cifs@vger.kernel.org Cc: smfrench@gmail.com, Aurelien Aptel , stable@vger.kernel.org Subject: Re: [PATCH] CIFS: fix use-after-free of the lease keys In-Reply-To: <20190131124607.2458-1-aaptel@suse.com> References: <20190131124607.2458-1-aaptel@suse.com> Date: Thu, 31 Jan 2019 10:52:29 -0200 Message-ID: <87zhrhat0y.fsf@paulo.ac> MIME-Version: 1.0 Content-Type: text/plain Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org Aurelien Aptel writes: > The request buffers are freed right before copying the pointers. > Use the func args instead which are identical and still valid. > > Simple reproducer (requires KASAN enabled) on a cifs mount: > > echo foo > foo ; tail -f foo & rm foo > > Cc: # 4.20 > Fixes: 179e44d49c2f ("smb3: add tracepoint for sending lease break responses to server") > Signed-off-by: Aurelien Aptel > --- > fs/cifs/smb2pdu.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/fs/cifs/smb2pdu.c b/fs/cifs/smb2pdu.c > index 846e605175bf..54181387a770 100644 > --- a/fs/cifs/smb2pdu.c > +++ b/fs/cifs/smb2pdu.c > @@ -4435,8 +4435,8 @@ SMB2_lease_break(const unsigned int xid, struct cifs_tcon *tcon, > rc = cifs_send_recv(xid, ses, &rqst, &resp_buf_type, flags, &rsp_iov); > cifs_small_buf_release(req); > > - please_key_low = (__u64 *)req->LeaseKey; > - please_key_high = (__u64 *)(req->LeaseKey+8); > + please_key_low = (__u64 *)lease_key; > + please_key_high = (__u64 *)(lease_key+8); > if (rc) { > cifs_stats_fail_inc(tcon, SMB2_OPLOCK_BREAK_HE); > trace_smb3_lease_err(le32_to_cpu(lease_state), tcon->tid, > -- > 2.16.4 Reviewed-by: Paulo Alcantara Thanks! Paulo