Received: by 10.192.165.148 with SMTP id m20csp855682imm; Fri, 27 Apr 2018 08:35:01 -0700 (PDT) X-Google-Smtp-Source: AB8JxZoCh0pC1sGDn0paJoyXeWlK0Oy4sRY4QCfluhJMoWzRVDrkxlAlxnhazhxz9fItEv4f0Ex9 X-Received: by 2002:a17:902:a512:: with SMTP id s18-v6mr2708857plq.223.1524843301579; Fri, 27 Apr 2018 08:35:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524843301; cv=none; d=google.com; s=arc-20160816; b=z/R0qYMyT7M430eM3Zw19lZKfWBM3zYNrSniPvMUFyW11fJEPQ0/+d2kw/cEh0u4S1 xcO8MDm7rQvsF60MXvtnOF5u9iht+DEd8xKuqyvkSSPFm03T4Ymsqe7NT5j0aC/X+6N+ ZOS0kUs2zq4QNuD1HigJxKpHQfsDxPELfzWtfBV8+S7cwh1uv9p2oKeYO+pDmGyVj/mF 9P/nGHeJzyANa4R1qWmH7HouEZtM+wb+Ley94fPQLnmysaa40rq3R7nBuZMs6tyIv//e UEycbOqTBvCKXlyRvWt2Vvvn0L50mAMJ+8jgaAsoZFr5+ZABNcTZc5DGjMFxN6Brhn11 ngRA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from:dmarc-filter :arc-authentication-results; bh=P/vS5V2iMnC7y8dme3Po9rwod8+4V6lxUTu597BppKE=; b=zj02q5sPEl7iFE8xOYH0aukZbjYWIDnRB0I7Wlg3mNUxX2+Ks35quuEMKVg+YNYHNF iyAvWTgiikJNZOujayBg4I9NCPZVwlcdsnelQfC3b8FTu0uh5e1zgDSk++dPSxXPlKMq A/V7cmSe9CM9+D/saASzLaqAwAVVcjtWyp8NMt3xjxE22nSqoHbBlpdBXOY8HG7HuqTo dj2DHigxcZjV8fWBkMA+1+WmzL4AbkWyWmptEwsyitW2CC3Y6hVADAUleS8cycWCTQ1N /SnwXjQ6XCZAf7NAQqVo8f0mDUqIFCXvlw7xr9OvfGy/Gh19xUopHTfjRTVwxi0mm7Rb BcGg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h8-v6si1473033pln.54.2018.04.27.08.34.47; Fri, 27 Apr 2018 08:35:01 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933011AbeD0OAj (ORCPT + 99 others); Fri, 27 Apr 2018 10:00:39 -0400 Received: from mail.kernel.org ([198.145.29.99]:47750 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932989AbeD0OAf (ORCPT ); Fri, 27 Apr 2018 10:00:35 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 0570B21890; Fri, 27 Apr 2018 14:00:34 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0570B21890 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=linuxfoundation.org Authentication-Results: mail.kernel.org; spf=fail smtp.mailfrom=gregkh@linuxfoundation.org From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Gustavo A. R. Silva" , Colin Ian King , Pavel Shilovsky , Eryu Guan , Ronnie Sahlberg , Steve French Subject: [PATCH 4.4 01/50] cifs: do not allow creating sockets except with SMB1 posix exensions Date: Fri, 27 Apr 2018 15:58:03 +0200 Message-Id: <20180427135655.691568591@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180427135655.623669681@linuxfoundation.org> References: <20180427135655.623669681@linuxfoundation.org> User-Agent: quilt/0.65 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.4-stable review patch. If anyone has any objections, please let me know. ------------------ From: Steve French commit 1d0cffa674cfa7d185a302c8c6850fc50b893bed upstream. RHBZ: 1453123 Since at least the 3.10 kernel and likely a lot earlier we have not been able to create unix domain sockets in a cifs share when mounted using the SFU mount option (except when mounted with the cifs unix extensions to Samba e.g.) Trying to create a socket, for example using the af_unix command from xfstests will cause : BUG: unable to handle kernel NULL pointer dereference at 00000000 00000040 Since no one uses or depends on being able to create unix domains sockets on a cifs share the easiest fix to stop this vulnerability is to simply not allow creation of any other special files than char or block devices when sfu is used. Added update to Ronnie's patch to handle a tcon link leak, and to address a buf leak noticed by Gustavo and Colin. Acked-by: Gustavo A. R. Silva CC: Colin Ian King Reviewed-by: Pavel Shilovsky Reported-by: Eryu Guan Signed-off-by: Ronnie Sahlberg Signed-off-by: Steve French Cc: stable@vger.kernel.org Signed-off-by: Greg Kroah-Hartman --- fs/cifs/dir.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) --- a/fs/cifs/dir.c +++ b/fs/cifs/dir.c @@ -673,6 +673,9 @@ int cifs_mknod(struct inode *inode, stru goto mknod_out; } + if (!S_ISCHR(mode) && !S_ISBLK(mode)) + goto mknod_out; + if (!(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_UNX_EMUL)) goto mknod_out; @@ -681,10 +684,8 @@ int cifs_mknod(struct inode *inode, stru buf = kmalloc(sizeof(FILE_ALL_INFO), GFP_KERNEL); if (buf == NULL) { - kfree(full_path); rc = -ENOMEM; - free_xid(xid); - return rc; + goto mknod_out; } if (backup_cred(cifs_sb)) @@ -731,7 +732,7 @@ int cifs_mknod(struct inode *inode, stru pdev->minor = cpu_to_le64(MINOR(device_number)); rc = tcon->ses->server->ops->sync_write(xid, &fid, &io_parms, &bytes_written, iov, 1); - } /* else if (S_ISFIFO) */ + } tcon->ses->server->ops->close(xid, tcon, &fid); d_drop(direntry);