From patchwork Fri Jul 16 16:15:25 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kulikov Vasiliy X-Patchwork-Id: 112463 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.4/8.14.3) with ESMTP id o6GGG2wV012048 for ; Fri, 16 Jul 2010 16:16:02 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S966011Ab0GPQPp (ORCPT ); Fri, 16 Jul 2010 12:15:45 -0400 Received: from mail-ey0-f174.google.com ([209.85.215.174]:45293 "EHLO mail-ey0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965991Ab0GPQPn (ORCPT ); Fri, 16 Jul 2010 12:15:43 -0400 Received: by eya25 with SMTP id 25so558144eya.19 for ; Fri, 16 Jul 2010 09:15:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:from:to:cc:subject:date :message-id:x-mailer; bh=j0kDYeloyQJSmQkorQY0hM1qcUhQZ+fSZsaAewo7jcQ=; b=JwLCEnjX4YtO0P4fbn1SVG6CP2kg5bu9iWibl3K84ldxCkJhQAeIhB0Ar4yHCCvoYz /LFFauzeJLzMTr61TgkkmPu+nOrSYPobINxjA/FvBtTAGH7Ji5sxlxw2DLg/9bruZL6J VIbOfOMvrZ18vyLW7intwZ9qpRYvPiKW5e1u0= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer; b=ocUHkOj6CAifCP8uWxHkVGus1PCaZpfjriINH9KZ8bKatIKyV08UsrdcMncuaxm0XL 2uZkqfhPvCm5tXLAB4Wl85wXmf7KcZ2es1chZY4Q/MCpGI3nuOObp4pfpU1HdTFN0Iux gFe0aZw4pVefPFu14NR0tiEFVTE9fsjTsHZl8= Received: by 10.213.7.2 with SMTP id b2mr1319683ebb.22.1279296941885; Fri, 16 Jul 2010 09:15:41 -0700 (PDT) Received: from localhost ([213.87.81.68]) by mx.google.com with ESMTPS id z55sm19274437eeh.15.2010.07.16.09.15.33 (version=TLSv1/SSLv3 cipher=RC4-MD5); Fri, 16 Jul 2010 09:15:41 -0700 (PDT) From: Kulikov Vasiliy To: kernel-janitors@vger.kernel.org Cc: Steve French , Jeff Layton , Dave Kleikamp , Tejun Heo , Joe Perches , linux-cifs@vger.kernel.org, samba-technical@lists.samba.org, linux-kernel@vger.kernel.org Subject: [PATCH 10/15] fs: cifs: check kmalloc() result Date: Fri, 16 Jul 2010 20:15:25 +0400 Message-Id: <1279296925-25147-1-git-send-email-segooon@gmail.com> X-Mailer: git-send-email 1.7.0.4 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 (demeter.kernel.org [140.211.167.41]); Fri, 16 Jul 2010 16:16:02 +0000 (UTC) diff --git a/fs/cifs/readdir.c b/fs/cifs/readdir.c index daf1753..d5e591f 100644 --- a/fs/cifs/readdir.c +++ b/fs/cifs/readdir.c @@ -847,6 +847,11 @@ int cifs_readdir(struct file *file, void *direntry, filldir_t filldir) end_of_smb = cifsFile->srch_inf.ntwrk_buf_start + max_len; tmp_buf = kmalloc(UNICODE_NAME_MAX, GFP_KERNEL); + if (tmp_buf == NULL) { + rc = -ENOMEM; + break; + } + for (i = 0; (i < num_to_fill) && (rc == 0); i++) { if (current_entry == NULL) { /* evaluate whether this case is an error */