Received: by 10.192.165.156 with SMTP id m28csp1736275imm; Sat, 14 Apr 2018 05:20:56 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+WhJ2GWfaDHzJ6hSi5ck97RmvOlJAERi15kTaNDY1OnLt9LTtEnZvX5V9sl6BBROlqp8l5 X-Received: by 2002:a17:902:ac1:: with SMTP id 59-v6mr8704857plp.367.1523708456453; Sat, 14 Apr 2018 05:20:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523708456; cv=none; d=google.com; s=arc-20160816; b=Z457+4LvnTB4VeUmVR08i5c3dALzOCYKr+zTB4p/5sXMN0+NRVEuIpzXHKvLWdRBrG WgPdGCtBkLE1MOlK184jSMc/CG0IM0nu2HJilKDFmdZ8wdyhXsGjJKpUOKHyb3CnJ0SD rZB5ChLyyUp9faXZcsQsZxDnEJqq6WzZxeKztj6TlZl6siiF7IGdPyG2DTtRP62WbvSA dZT6qmodFvjf8s20bTpbA7cRys2ZDPKzt3mNyhHnF7GDfIrqJEz+svuJd6XkOR8rJxZ5 DguSTDZOwqlvph1Yzteefd+LgYnXHMWwB2eflBLdIMZpDpS8WhXHa9Yx0zzdoAj238ea wLWA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :arc-authentication-results; bh=EYc3m8qYl9Vy1CfAmWpZnN91u9ueVDrPp0Fdr1dkews=; b=Et3oIErEwlfY+lrvcpvcLgWKY5hCt0Jru8ZG4uZOGnKcoN7RhjgaXaUFoPDJiqzmBN eGVSVUnl0gog8DPze4NkiBTLFEw/4CWPygFi+NIY3f9WUFPgF3PUcqm+seE1cthyVSXA t8zhqsVT3wiM6UEPOrjKZxGzoCUj6G6B7Sm5rmrKoh1oV9HSlIxujENYcWQImRr7eBPm WO1EYp2/QoB6EwlCeTnVTwQ0yOy0MKxj2yWbWxHow3z56AXJFT6qES4c/9PCe8WnVLf6 m4/feZHcr4T6uv2K0I7Uy29LeCVMoMbbnZVT8BnJGRfJ1lLb+SCW5DX+rxPBPDdv+1Ht oIag== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o10si6070407pgq.432.2018.04.14.05.20.07; Sat, 14 Apr 2018 05:20:56 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751073AbeDNMQn (ORCPT + 99 others); Sat, 14 Apr 2018 08:16:43 -0400 Received: from mout.gmx.net ([212.227.15.15]:57229 "EHLO mout.gmx.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750965AbeDNMQm (ORCPT ); Sat, 14 Apr 2018 08:16:42 -0400 Received: from localhost.localdomain ([122.225.81.134]) by mail.gmx.com (mrgmx003 [212.227.17.184]) with ESMTPSA (Nemesis) id 0LcBin-1eha8t1eKr-00jWV0; Sat, 14 Apr 2018 14:16:27 +0200 From: Chengguang Xu To: jack@suse.cz, dhowells@redhat.com, elfring@users.sourceforge.net, viro@zeniv.linux.org.uk Cc: linux-kernel@vger.kernel.org, Chengguang Xu Subject: [PATCH] isofs: fix potential memory leak in mount option parsing Date: Sat, 14 Apr 2018 20:16:06 +0800 Message-Id: <1523708166-32728-1-git-send-email-cgxu519@gmx.com> X-Mailer: git-send-email 1.8.3.1 X-Provags-ID: V03:K1:DLsM4FB0H9W2y+LkOpeVnZMr/ZFZxlCBOU1rKg5ESTGqRu4/gAh MEM4ATSfmoV5XS/51IuiduVZYBHI+So5w9jTAVbcIwSPfz0oJuyhTCqk7gt0Lr/b16XqJzi +ZlPXqNcaTHJ7q4M3kBg582SHrFeOjCA+v5InC4FxWWa1Aa7/lmJfGod1vJO9RN62310/t7 umrbukjGyCnibObAjRDTw== X-UI-Out-Filterresults: notjunk:1;V01:K0:KFbOoVnCpLs=:XpWycA5as1/BTmAuOHsOJd V0aXEfZvK3pd/aO2tQiAQHMEJOEvWO3jJCgYxhXGUx+8mlDUvWhOLm61EwOV+hC6Huf4PXnsV JOnqSK9ymBEIeGYqfw0zDtUnAelkM5Rd6BJHKQ6M/iyk2zpoA89tvdITx42p6ItOmQYyLhsoq rT5+HNYw+TJtlNuQU05Omytza3MhG7b6EH4fnSFxHU08FKLSR92VNSUeGawt6Aay0BXxxhTqW TxDm778NNYrxxi4/p6TGguVTrbIIm8dVih0Ra5CwH/XINJN4FqKG2rc45rK2VkslpFYhYzr/E wRzHksEGtq7KiiwJdfE3GanAYF6a4e+ZV8EBBxHReDSFAWfKPlVA2DLEP/wAHgpOZiJy0wmuL ARx6zibX+yfq/NEFEnR6ty/2K55qHUVqZ1AZW3jRPR45KxliCepYe+9F3r4geDQ+L1aUCX99V 09MAw2EVFxwgf5zw694lGDL7fOso6x2msYXlQqowFPfAaPVlPFWNTlexJZ7akPSrMasIF1eiz tjmQsibTlYzCzZn0UYKu8NuUNZ7AhSxE0duFmUqRKrHBgAmFbfsjs+I3GgoQJKio9vljTnTNy K657BMwKLT11+SbE9goUnI7HtfcGkM7T3+s3AhzAay/GYfMuZFnRYXotc7KyECd3fYb3iGi6v mg4M2WrNWCkK28jbTNZvGVIiqg+hmnkh2NVz9Lig7oifHBjRqMnVyfZYxfdRT594LzesCy/0k EztZEXEllapYUDKOnEnDXUZSQHL+o37Uf2SK6MjpzR3xWQHVJgw2mHBIUAm5sbzhV1j3huo3s zzzeF+FNLIs5A8FJl3oACLdWSgxiQ== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When specifying string type mount option (e.g., iocharset) several times in a mount, current option parsing may cause memory leak. Hence, call kfree for previous one in this case. Meanwhile, check memory allocation result for it. Signed-off-by: Chengguang Xu --- fs/isofs/inode.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/fs/isofs/inode.c b/fs/isofs/inode.c index bc258a4..ec3fba7 100644 --- a/fs/isofs/inode.c +++ b/fs/isofs/inode.c @@ -394,7 +394,10 @@ static int parse_options(char *options, struct iso9660_options *popt) break; #ifdef CONFIG_JOLIET case Opt_iocharset: + kfree(popt->iocharset); popt->iocharset = match_strdup(&args[0]); + if (!popt->iocharset) + return 0; break; #endif case Opt_map_a: -- 1.8.3.1