From patchwork Wed Apr 18 23:01:09 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ronnie Sahlberg X-Patchwork-Id: 900468 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=linux-cifs-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 40RK1c57VLz9s1w for ; Thu, 19 Apr 2018 10:02:44 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752848AbeDSACn (ORCPT ); Wed, 18 Apr 2018 20:02:43 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:53474 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752245AbeDSACn (ORCPT ); Wed, 18 Apr 2018 20:02:43 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 343607CBBA; Thu, 19 Apr 2018 00:02:42 +0000 (UTC) Received: from test1190.test.redhat.com (vpn2-54-87.bne.redhat.com [10.64.54.87]) by smtp.corp.redhat.com (Postfix) with ESMTP id 63CD61134CD6; Thu, 19 Apr 2018 00:02:39 +0000 (UTC) From: Ronnie Sahlberg To: linux-cifs Cc: Steve French Subject: [PATCH] cifs: do not allow creating sockets in SMB1 Date: Thu, 19 Apr 2018 09:01:09 +1000 Message-Id: <20180418230109.6859-2-lsahlber@redhat.com> In-Reply-To: <20180418230109.6859-1-lsahlber@redhat.com> References: <20180418230109.6859-1-lsahlber@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Thu, 19 Apr 2018 00:02:42 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Thu, 19 Apr 2018 00:02:42 +0000 (UTC) for IP:'10.11.54.3' DOMAIN:'int-mx03.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'lsahlber@redhat.com' RCPT:'' Sender: linux-cifs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-cifs@vger.kernel.org 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. 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 disallow creation of such sockets. Reported-by: Eryu Guan Signed-off-by: Ronnie Sahlberg --- fs/cifs/dir.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/fs/cifs/dir.c b/fs/cifs/dir.c index 81ba6e0d88d8..2ba68fcb6df3 100644 --- a/fs/cifs/dir.c +++ b/fs/cifs/dir.c @@ -637,6 +637,9 @@ int cifs_mknod(struct inode *inode, struct dentry *direntry, umode_t mode, struct win_dev *pdev; struct kvec iov[2]; + if (S_ISSOCK(mode)) + return -EINVAL; + if (!old_valid_dev(device_number)) return -EINVAL;