Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp118315pxu; Thu, 10 Dec 2020 20:29:56 -0800 (PST) X-Google-Smtp-Source: ABdhPJxlzQDxE2XXrDnr188ODH9z914P+VyzTMsfJ1Uz2S4WTuVBGsq0NF0trFXTBRaIAOHuOtXZ X-Received: by 2002:a50:fe96:: with SMTP id d22mr9912462edt.143.1607660996008; Thu, 10 Dec 2020 20:29:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607660996; cv=none; d=google.com; s=arc-20160816; b=KJBwhbHb+aV2OdF8dgc4yLf/ttY9MGnVlYDeYYW8msJhTSdqWrh5WqrTZ7iwZpjg3i dRGtK4CX3/cAKyAcVqDzLCKMN4106vaII/0v7wWnkJmA3dHqDg8EyICS6yTNiYaz6bv2 Dr6wAjxpLVLfq1Cc4v+cZV7JRtE4ATaikYVE+6QhARtN3BD6ywKcGWYcnrpRZ1mw8GWA D+CIxUYftLQD3i2Z4C3mD6hk2RW7w7XrKtbsGIUA2rTflGCQuw/8J/95EdrmQMXGaCGR lV/Ooj17aVira0YMMZkuVXnXCkalQLvryGkXNef1roJsVYuGPAsLIDYosyOJwNJXi2ie 4ojw== 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=FqKm8XBr6iLbImnJDTpmggu2CkWKYp1rROthhQxZYx8=; b=joZtW1dtGB3xMnl9zzcYnWHpWXvs+jgoFd3FLMHg6eulmnXufsuwHegHUVGPhgdI96 CAe6hQcdDbvUPktwzlczIt6tP4ubzP/hopB+D/0TG1FbSzBbFhMfNI6CWPl9dPzktiGZ EYdCkoGY8b5a8DySPbELrUPypgbryiNIhf9iugm6Krelcz9JudnAIXxMcnKKy02/+BaT oBaFdlEAUx3GEVSz1+VhnnXhD10q/RCDpOx5hC+H00qwxhkT1zNn52JXf3eCSvTlVMYy FTob1rneRJty/5FBllFHQF8Jd/HN7mX1dbN34mTkMbuGEzvRh1HqGrMP3hai/pgslcMO gA3w== 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 r22si3928277eji.295.2020.12.10.20.29.33; Thu, 10 Dec 2020 20:29:55 -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 S2390331AbgLJOal (ORCPT + 99 others); Thu, 10 Dec 2020 09:30:41 -0500 Received: from mail.kernel.org ([198.145.29.99]:36422 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726013AbgLJO2j (ORCPT ); Thu, 10 Dec 2020 09:28:39 -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.4 26/39] cifs: fix potential use-after-free in cifs_echo_request() Date: Thu, 10 Dec 2020 15:26:37 +0100 Message-Id: <20201210142602.188747692@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201210142600.887734129@linuxfoundation.org> References: <20201210142600.887734129@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 @@ -783,6 +783,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);