From patchwork Wed Feb 27 05:18:53 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Yongjun X-Patchwork-Id: 223501 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 7BD1F2C007B for ; Wed, 27 Feb 2013 16:18:56 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751548Ab3B0FSy (ORCPT ); Wed, 27 Feb 2013 00:18:54 -0500 Received: from mail-bk0-f54.google.com ([209.85.214.54]:38707 "EHLO mail-bk0-f54.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750805Ab3B0FSy (ORCPT ); Wed, 27 Feb 2013 00:18:54 -0500 Received: by mail-bk0-f54.google.com with SMTP id w5so68547bku.41 for ; Tue, 26 Feb 2013 21:18:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:date:message-id:subject:from:to:cc :content-type; bh=9Geg38mQW9+ujGAIP6G679Ble2asgVlhH9/iA9UXxM0=; b=WZSjdO7OajXLTNex4ssaXbmU0NIe9RrGIM0CPWyFbuNVbOGYBT4+Bp5SN+hcghCZRN v+aPmdleE7zHLYq+gSqqbjKoX9Xlh56M4wMiYGf7cQFu0rOxxsQ/TT9/quO7P8Lr7enG qi1i726YxxTilxsGbLfQujyhCwTU6h+leq3pCVkQa/4N3usdDvsMV8tHcR8JrIq0aDEA S4JHhz8qqkFh46t2PkzDkapaq0W1qvfdwpZRvRlu5RhllowwYtcMz1KQXM2NtsqLYrSE 4EOqEsbO7AODBYI7DY8iOLsjxGs7ltFs11KBfZRBgwdnSgrqZKkCMgjqeyeIO8fabsUg RBQw== MIME-Version: 1.0 X-Received: by 10.204.147.82 with SMTP id k18mr210966bkv.38.1361942333104; Tue, 26 Feb 2013 21:18:53 -0800 (PST) Received: by 10.204.30.210 with HTTP; Tue, 26 Feb 2013 21:18:53 -0800 (PST) Date: Wed, 27 Feb 2013 13:18:53 +0800 Message-ID: Subject: [PATCH] ext4: fix possible memory leak in ext4_remount() From: Wei Yongjun To: tytso@mit.edu, adilger.kernel@dilger.ca Cc: yongjun_wei@trendmicro.com.cn, linux-ext4@vger.kernel.org Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org From: Wei Yongjun 'orig_data' is malloced in ext4_remount() and should be freed before leaving from the error handling cases, otherwise it will cause memory leak. Signed-off-by: Wei Yongjun Reviewed-by: Lukas Czerner --- fs/ext4/super.c | 1 + 1 file changed, 1 insertion(+) -- To unsubscribe from this list: send the line "unsubscribe linux-ext4" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/fs/ext4/super.c b/fs/ext4/super.c index 373d46c..8ae09e3 100644 --- a/fs/ext4/super.c +++ b/fs/ext4/super.c @@ -4538,6 +4538,7 @@ static int ext4_remount(struct super_block *sb, int *flags, char *data) if (!old_opts.s_qf_names[i]) { for (j = 0; j < i; j++) kfree(old_opts.s_qf_names[j]); + kfree(orig_data); return -ENOMEM; } } else