From patchwork Mon Aug 31 13:28:59 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: roel kluin X-Patchwork-Id: 53735 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.samba.org (fn.samba.org [216.83.154.106]) by ozlabs.org (Postfix) with ESMTP id 25C4CB7D20 for ; Thu, 27 May 2010 22:34:42 +1000 (EST) Received: from fn.samba.org (localhost [127.0.0.1]) by lists.samba.org (Postfix) with ESMTP id 7B53CACF4A; Thu, 27 May 2010 06:34:36 -0600 (MDT) X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on fn.samba.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=3.8 tests=BAYES_00,SPF_PASS autolearn=ham version=3.2.5 X-Original-To: linux-cifs-client@lists.samba.org Delivered-To: linux-cifs-client@lists.samba.org Received: from ey-out-1920.google.com (ey-out-1920.google.com [74.125.78.144]) by lists.samba.org (Postfix) with ESMTP id EDE1CACFDF; Mon, 31 Aug 2009 07:14:09 -0600 (MDT) Received: by ey-out-1920.google.com with SMTP id 5so740825eyb.10 for ; Mon, 31 Aug 2009 06:23:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from :user-agent:mime-version:to:subject:content-type :content-transfer-encoding; bh=c2jYGGMCXrvBWUAE6XxOMjXJ6l/IdzWWlxx5QUixQkE=; b=bjz1a42Y8MvxWPcsafvvVVu0U1jttc8ipbtjlX2HLDOCxygUH9HyTC8X4+GR/pn1nl +7JH+XzCJ846aRGTC016NYYYU9YkzqJA2dtenp0tP7sRqRZ0QJfHH2HALpdQOHlSbXmm 7jZDIrwa0JA7vxvqGFtwiSjW6u6P/5U4fsSP8= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:subject :content-type:content-transfer-encoding; b=H4IVUHePVatm+8DaOAyFvCznANNbhY0yqJG8pb+pRlJWZgmNMK/1KQA/G+9bnP9nmj kPyOV7VJ45xuCORkQSVF/bjrQpip4wOzem6VPseUd6MCYb1bKqcibyIgeQQLPDzB6l/s E1Z76xgsaPmyL0LCTObHsNF4viboX/GwH0dHI= Received: by 10.216.0.73 with SMTP id 51mr1134695wea.52.1251725002491; Mon, 31 Aug 2009 06:23:22 -0700 (PDT) Received: from zoinx.mars (d133062.upc-d.chello.nl [213.46.133.62]) by mx.google.com with ESMTPS id 28sm69521eyg.9.2009.08.31.06.23.21 (version=SSLv3 cipher=RC4-MD5); Mon, 31 Aug 2009 06:23:22 -0700 (PDT) Message-ID: <4A9BD01B.4080405@gmail.com> Date: Mon, 31 Aug 2009 15:28:59 +0200 From: Roel Kluin User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.1) Gecko/20090814 Fedora/3.0-2.6.b3.fc11 Thunderbird/3.0b3 MIME-Version: 1.0 To: Steve French , linux-cifs-client@lists.samba.org, samba-technical@lists.samba.org, Andrew Morton X-Mailman-Approved-At: Thu, 27 May 2010 06:34:18 -0600 Subject: [linux-cifs-client] [PATCH] cifs: potential NULL dereference in parse_DFS_referrals() X-BeenThere: linux-cifs-client@lists.samba.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: The Linux CIFS VFS client List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-cifs-client-bounces@lists.samba.org Errors-To: linux-cifs-client-bounces@lists.samba.org allocation may fail, prevent a NULL dereference. Signed-off-by: Roel Kluin diff --git a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c index b195773..7ea3240 100644 --- a/fs/cifs/cifssmb.c +++ b/fs/cifs/cifssmb.c @@ -3963,6 +3963,10 @@ parse_DFS_referrals(TRANSACTION2_GET_DFS_REFER_RSP *pSMBr, GFP_KERNEL); cifsConvertToUCS((__le16 *) tmp, searchName, PATH_MAX, nls_codepage, remap); + if (tmp == NULL) { + rc = -ENOMEM; + goto parse_DFS_referrals_exit; + } node->path_consumed = cifs_ucs2_bytes(tmp, le16_to_cpu(pSMBr->PathConsumed), nls_codepage);