From patchwork Mon Jul 25 13:59:10 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pavel Shilovsky X-Patchwork-Id: 1004402 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.4) with ESMTP id p6PDxLgk007903 for ; Mon, 25 Jul 2011 13:59:21 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751982Ab1GYN7V (ORCPT ); Mon, 25 Jul 2011 09:59:21 -0400 Received: from mail-fx0-f52.google.com ([209.85.161.52]:51766 "EHLO mail-fx0-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751269Ab1GYN7U (ORCPT ); Mon, 25 Jul 2011 09:59:20 -0400 Received: by fxd18 with SMTP id 18so9120658fxd.11 for ; Mon, 25 Jul 2011 06:59:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer; bh=z8Xlsm5mpIZB7dwKjokxYfrS2imAyQaiFK9IOVVisX8=; b=aggX/dWQFAX6L05jiPrfnmghX3A/z4Vvd+Bv5xHTSVnv0NjVpr98/fDX9TnGHYoQTE QH7JvTNuKMSpslK5hyTOUsg0pcJBLR3d/RshSvJThHIYI6is1gfnB9wlkiz1n3Q8iddD 8R5UIGfs+/CthWYHEDDNmq0tFxahN9DhtcmuU= Received: by 10.204.169.66 with SMTP id x2mr1343231bky.399.1311602359272; Mon, 25 Jul 2011 06:59:19 -0700 (PDT) Received: from localhost.localdomain (PPPoE-78-29-68-161.san.ru [78.29.68.161]) by mx.google.com with ESMTPS id p16sm1337229bku.31.2011.07.25.06.59.16 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 25 Jul 2011 06:59:17 -0700 (PDT) From: Pavel Shilovsky To: linux-cifs@vger.kernel.org Cc: viro@zeniv.linux.org.uk, smfrench@gmail.com, Jeff Layton Subject: [PATCH] CIFS: Fix oops while mounting with prefixpath Date: Mon, 25 Jul 2011 17:59:10 +0400 Message-Id: <1311602350-10857-1-git-send-email-piastryyy@gmail.com> X-Mailer: git-send-email 1.7.1 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.6 (demeter1.kernel.org [140.211.167.41]); Mon, 25 Jul 2011 13:59:21 +0000 (UTC) commit fec11dd9a0109fe52fd631e5c510778d6cbff6cc caused a regression when we have already mounted //server/share/a and want to mount //server/share/a/b. The problem is that lookup_one_len calls __lookup_hash with nd pointer as NULL. Then __lookup_hash calls do_revalidate in the case when dentry exists and we end up with NULL pointer deference in cifs_d_revalidate: if (nd->flags & LOOKUP_RCU) return -ECHILD; Fix this by checking nd for NULL. Signed-off-by: Pavel Shilovsky --- fs/cifs/dir.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/fs/cifs/dir.c b/fs/cifs/dir.c index fa8c21d..d8d26f3 100644 --- a/fs/cifs/dir.c +++ b/fs/cifs/dir.c @@ -641,7 +641,7 @@ lookup_out: static int cifs_d_revalidate(struct dentry *direntry, struct nameidata *nd) { - if (nd->flags & LOOKUP_RCU) + if (nd && (nd->flags & LOOKUP_RCU)) return -ECHILD; if (direntry->d_inode) {