From patchwork Wed May 3 15:39:08 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Disseldorp X-Patchwork-Id: 9710013 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 9F7D260362 for ; Wed, 3 May 2017 15:39:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 90FFB28637 for ; Wed, 3 May 2017 15:39:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 85D3F2863B; Wed, 3 May 2017 15:39:21 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3598B28639 for ; Wed, 3 May 2017 15:39:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751817AbdECPjU (ORCPT ); Wed, 3 May 2017 11:39:20 -0400 Received: from mx2.suse.de ([195.135.220.15]:36667 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751538AbdECPjU (ORCPT ); Wed, 3 May 2017 11:39:20 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 35309ABE1 for ; Wed, 3 May 2017 15:39:19 +0000 (UTC) From: David Disseldorp To: linux-cifs@vger.kernel.org Cc: David Disseldorp Subject: [PATCH 1/2] cifs: fix CIFS_ENUMERATE_SNAPSHOTS oops Date: Wed, 3 May 2017 17:39:08 +0200 Message-Id: <20170503153909.5783-2-ddiss@suse.de> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20170503153909.5783-1-ddiss@suse.de> References: <20170503153909.5783-1-ddiss@suse.de> Sender: linux-cifs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-cifs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP As with 618763958b22, an open directory may have a NULL private_data pointer prior to readdir. CIFS_ENUMERATE_SNAPSHOTS must check for this before dereference. Fixes: 834170c85978 ("Enable previous version support") Signed-off-by: David Disseldorp --- fs/cifs/ioctl.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/fs/cifs/ioctl.c b/fs/cifs/ioctl.c index 7f4bba574930..4d598a71cf84 100644 --- a/fs/cifs/ioctl.c +++ b/fs/cifs/ioctl.c @@ -213,6 +213,8 @@ long cifs_ioctl(struct file *filep, unsigned int command, unsigned long arg) rc = smb_mnt_get_fsinfo(xid, tcon, (void __user *)arg); break; case CIFS_ENUMERATE_SNAPSHOTS: + if (pSMBFile == NULL) + break; if (arg == 0) { rc = -EINVAL; goto cifs_ioc_exit;