Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp36616pxu; Thu, 10 Dec 2020 17:30:13 -0800 (PST) X-Google-Smtp-Source: ABdhPJySGhaY9yZimAqOtFmKGB8UCvqorPje1FMT1UF4OGUHYwdeI3W24/+vkMTd0+tqZzgXZLp5 X-Received: by 2002:a17:906:2f87:: with SMTP id w7mr8959243eji.83.1607650213751; Thu, 10 Dec 2020 17:30:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607650213; cv=none; d=google.com; s=arc-20160816; b=wVw1qkNRPM/qv0HS9szNcr1W7iJ+A21AopwJKTKxcuHZxb8cPHMhSpP0JaN4tUOBzb Y+NMjZn7kBn1P8aSJPFoPGq3H1NTM7b3w6ZSk355XxyS/CaO5AQqfjvUUBwVbAjv+RTg d3qUPAWNlOTB+9kXw9hNDvJ1tbrXqK7hrGyiDJjgOGbgsjtON1c5BFpXEY2kvC/Z/KMl yOR4GL3jMEPYhTaSRwjh+7dN1nhdSMPevMGLelcfP5PxkonMhBnwKcE618fG0+Uf0/aP exg8TahJ31dBKYfnWcjk9OuLKvisStn55Uzp8m2nAA0iJdw2uQrOluMGG8FYcbmfUIS/ co1Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from; bh=EeJMkyj3rLoUXwmxUmgl4okrrF0eJrNGNbfeqjOnuDg=; b=e4FLDy/MbE/yXmZCRx2NEF/aowkjQgray6pVTMQQJ+JWBvDoKZw/QjGGPr9zI0cjmu iCes0rRnSDW9t7bQuTL4/uqXb+mNRkLJ3t5t/hanDb3kD5P0r6CBjSTggHa3bVc4pKv5 y72Ku55TskaZWk6GJxMDlZi1E0zwchc9iZiUbPTcPxpj46XApr3jFjUbgEPzHEPO0Gvr OsV1hQs+AyXH8vhKJLVEH67igUEIZbY9CN82Y2nvBPq1oUvCKRH0lln7SmT3QdgfkAaH MrbZ8vY2I2S2S64Xh9e5pFjzSCw1m6v0Av41nQ85hqkyP1hMPWCtxq4CSXT1uFa8Qnd+ mvFw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id zh18si3572899ejb.624.2020.12.10.17.29.50; Thu, 10 Dec 2020 17:30:13 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390816AbgLJOej (ORCPT + 99 others); Thu, 10 Dec 2020 09:34:39 -0500 Received: from mail.kernel.org ([198.145.29.99]:40672 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390580AbgLJOcs (ORCPT ); Thu, 10 Dec 2020 09:32:48 -0500 From: Greg Kroah-Hartman Authentication-Results: mail.kernel.org; dkim=permerror (bad message/signature format) To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Paulo Alcantara (SUSE)" , Ronnie Sahlberg , Steve French Subject: [PATCH 4.14 17/31] cifs: fix potential use-after-free in cifs_echo_request() Date: Thu, 10 Dec 2020 15:26:54 +0100 Message-Id: <20201210142602.955829564@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201210142602.099683598@linuxfoundation.org> References: <20201210142602.099683598@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Paulo Alcantara commit 212253367dc7b49ed3fc194ce71b0992eacaecf2 upstream. This patch fixes a potential use-after-free bug in cifs_echo_request(). For instance, thread 1 -------- cifs_demultiplex_thread() clean_demultiplex_info() kfree(server) thread 2 (workqueue) -------- apic_timer_interrupt() smp_apic_timer_interrupt() irq_exit() __do_softirq() run_timer_softirq() call_timer_fn() cifs_echo_request() <- use-after-free in server ptr Signed-off-by: Paulo Alcantara (SUSE) CC: Stable Reviewed-by: Ronnie Sahlberg Signed-off-by: Steve French Signed-off-by: Greg Kroah-Hartman --- fs/cifs/connect.c | 2 ++ 1 file changed, 2 insertions(+) --- a/fs/cifs/connect.c +++ b/fs/cifs/connect.c @@ -756,6 +756,8 @@ static void clean_demultiplex_info(struc list_del_init(&server->tcp_ses_list); spin_unlock(&cifs_tcp_ses_lock); + cancel_delayed_work_sync(&server->echo); + spin_lock(&GlobalMid_Lock); server->tcpStatus = CifsExiting; spin_unlock(&GlobalMid_Lock);