From patchwork Mon Nov 8 12:28:32 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Layton X-Patchwork-Id: 308262 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id oA8CR3ZI028890 for ; Mon, 8 Nov 2010 12:28:34 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752284Ab0KHM2e (ORCPT ); Mon, 8 Nov 2010 07:28:34 -0500 Received: from cdptpa-omtalb.mail.rr.com ([75.180.132.122]:51952 "EHLO cdptpa-omtalb.mail.rr.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751469Ab0KHM2d (ORCPT ); Mon, 8 Nov 2010 07:28:33 -0500 X-Authority-Analysis: v=1.1 cv=3jtQBdTzPyV+fq4oCU/u8ZPrJJGN11HvhaDVxyWhycI= c=1 sm=0 a=x-5WK7BL65QA:10 a=ld/erqUjW76FpBUqCqkKeA==:17 a=20KFwNOVAAAA:8 a=y2l-7gdMKcNNGrL0qNEA:9 a=YXXjEDZ_fWyyy7-tbzQf06jZnHgA:4 a=jEp0ucaQiEUA:10 a=ld/erqUjW76FpBUqCqkKeA==:117 X-Cloudmark-Score: 0 X-Originating-IP: 71.70.153.3 Received: from [71.70.153.3] ([71.70.153.3:38240] helo=mail.poochiereds.net) by cdptpa-oedge02.mail.rr.com (envelope-from ) (ecelerity 2.2.3.46 r()) with ESMTP id 6F/30-02631-1FCE7DC4; Mon, 08 Nov 2010 12:28:33 +0000 Received: by mail.poochiereds.net (Postfix, from userid 4447) id 7211D581AF; Mon, 8 Nov 2010 07:28:32 -0500 (EST) From: Jeff Layton To: smfrench@gmail.com Cc: sjayaraman@suse.de, kjella79@yahoo.no, linux-cifs@vger.kernel.org Subject: [PATCH] cifs: make cifs_ioctl handle NULL filp->private_data correctly Date: Mon, 8 Nov 2010 07:28:32 -0500 Message-Id: <1289219312-21396-1-git-send-email-jlayton@redhat.com> X-Mailer: git-send-email 1.7.2.3 Sender: linux-cifs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-cifs@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter1.kernel.org [140.211.167.41]); Mon, 08 Nov 2010 12:28:34 +0000 (UTC) diff --git a/fs/cifs/ioctl.c b/fs/cifs/ioctl.c index 2fa22f2..0c98672 100644 --- a/fs/cifs/ioctl.c +++ b/fs/cifs/ioctl.c @@ -38,10 +38,10 @@ long cifs_ioctl(struct file *filep, unsigned int command, unsigned long arg) struct cifs_sb_info *cifs_sb; #ifdef CONFIG_CIFS_POSIX struct cifsFileInfo *pSMBFile = filep->private_data; - struct cifsTconInfo *tcon = tlink_tcon(pSMBFile->tlink); + struct cifsTconInfo *tcon; __u64 ExtAttrBits = 0; __u64 ExtAttrMask = 0; - __u64 caps = le64_to_cpu(tcon->fsUnixInfo.Capability); + __u64 caps; #endif /* CONFIG_CIFS_POSIX */ xid = GetXid(); @@ -62,6 +62,10 @@ long cifs_ioctl(struct file *filep, unsigned int command, unsigned long arg) break; #ifdef CONFIG_CIFS_POSIX case FS_IOC_GETFLAGS: + if (pSMBFile == NULL) + break; + tcon = tlink_tcon(pSMBFile->tlink); + caps = le64_to_cpu(tcon->fsUnixInfo.Capability); if (CIFS_UNIX_EXTATTR_CAP & caps) { rc = CIFSGetExtAttr(xid, tcon, pSMBFile->netfid, &ExtAttrBits, &ExtAttrMask); @@ -73,6 +77,10 @@ long cifs_ioctl(struct file *filep, unsigned int command, unsigned long arg) break; case FS_IOC_SETFLAGS: + if (pSMBFile == NULL) + break; + tcon = tlink_tcon(pSMBFile->tlink); + caps = le64_to_cpu(tcon->fsUnixInfo.Capability); if (CIFS_UNIX_EXTATTR_CAP & caps) { if (get_user(ExtAttrBits, (int __user *)arg)) { rc = -EFAULT;