From patchwork Sun Jun 28 13:20:47 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mikulas Patocka X-Patchwork-Id: 6686161 Return-Path: X-Original-To: patchwork-linux-fsdevel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 28D949F1C1 for ; Sun, 28 Jun 2015 13:27:02 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 5DFDB2054C for ; Sun, 28 Jun 2015 13:27:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 762872054B for ; Sun, 28 Jun 2015 13:27:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752335AbbF1N05 (ORCPT ); Sun, 28 Jun 2015 09:26:57 -0400 Received: from 78-80-28-91.tmcz.cz ([78.80.28.91]:45479 "EHLO leontynka.twibright.com" rhost-flags-OK-FAIL-OK-OK) by vger.kernel.org with ESMTP id S1752145AbbF1N04 (ORCPT ); Sun, 28 Jun 2015 09:26:56 -0400 Received: from mikulas (helo=localhost) by leontynka.twibright.com with local-esmtp (Exim 4.72) (envelope-from ) id 1Z9CVr-0007gd-7C; Sun, 28 Jun 2015 15:20:47 +0200 Date: Sun, 28 Jun 2015 15:20:47 +0200 (CEST) From: Mikulas Patocka X-X-Sender: mikulas@leontynka To: Linus Torvalds cc: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org Subject: [PATCH] hpfs: kstrdup() out of memory handling Message-ID: User-Agent: Alpine 2.00 (DEB 1167 2008-08-23) MIME-Version: 1.0 Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Sanidhya Kashyap Date: Sat, 21 Mar 2015 12:57:50 -0400 There is a possibility of nothing being allocated to the new_opts in case of memory pressure, therefore return ENOMEM for such case. Signed-off-by: Sanidhya Kashyap Signed-off-by: Mikulas Patocka Cc: stable@vger.kernel.org --- fs/hpfs/super.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Index: linux-2.6/fs/hpfs/super.c =================================================================== --- linux-2.6.orig/fs/hpfs/super.c 2015-06-28 14:43:48.000000000 +0200 +++ linux-2.6/fs/hpfs/super.c 2015-06-28 14:45:11.000000000 +0200 @@ -459,11 +459,14 @@ static int hpfs_remount_fs(struct super_ int o; struct hpfs_sb_info *sbi = hpfs_sb(s); char *new_opts = kstrdup(data, GFP_KERNEL); - + + if (!new_opts) + return -ENOMEM; + sync_filesystem(s); *flags |= MS_NOATIME; - + hpfs_lock(s); uid = sbi->sb_uid; gid = sbi->sb_gid; umask = 0777 & ~sbi->sb_mode;