Received: by 2002:a25:b794:0:0:0:0:0 with SMTP id n20csp6399172ybh; Wed, 7 Aug 2019 23:23:06 -0700 (PDT) X-Google-Smtp-Source: APXvYqytlPzsWORGLtsHBXcBUNW7pEDub2+CBrybrHvBu9WRfTP3BFLUDmvwXeF3crIgISONEKX3 X-Received: by 2002:a63:1743:: with SMTP id 3mr10912281pgx.435.1565245386553; Wed, 07 Aug 2019 23:23:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565245386; cv=none; d=google.com; s=arc-20160816; b=M7BAAhFaOY0wqdt9ehJNpzpxjqJ/Q2PVYrMmvUl3D1yytAyBuD7Q1yz9d8BhH9kB9Z UEyhE3LCeLvkvW1G9NgmWChxNwGRJNL4kC9QkaET4HUgdOFizlyRfNlLFs5OzImHJ5Qu 1QX9v8wNbdCBgnx8qyGhnrHsvv2hZDn0JQAjg3g9K3M7Pd2lYE4CZV5FMXaqi7MQHgQl uaMFS3riMwPRItrdu+4CEjMwOUu4DXnBbv6Nj1mO6IlpB7FXEWZrw01KT60ki7HugoPu M1O0SnN5A11oZIqEKDHiP20VmPr1+OY8Q0e9qgvJGCM120FK6IJXTcyOxeYRGBt8PKjP 5hqA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:subject:cc:to:from:message-id:date; bh=sY/2b0UPwqaD3AnjLko2zSVtAG4YmkPH5FvSsVTWPIg=; b=BiBJ8mUj8A3Z/YroFt6u/Own6HgcLd4ucGr2MTxP+tjD0BX5aNxxK96eXQSml7Nsew X/W/P8AYEn7K+ejVYj+tuVaj86/miB78Fe8KXT4hHk0mVvQy2xddHhM84M20dLpNbK9Z kKfoa7FNCFNuUjWNLeL/ZN6ZrMeQHwwHGAJSqDmLn8mYq9A9xbrkb0lA8zvV7rBSdZhc 9f++6nbew2/o4osKa7SU3vbshTiW3NAnp+dP1sZJcW+mvVmfE34rixaea93oFEFNhYfZ PmFfDbuIHfcdoyDeWG/3X+jao4hk7cavjm/0f9gPHkN3Xn10Jy4mmkZ4t7DzbqSjFhVc wTlw== 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 q4si53681680pfg.286.2019.08.07.23.22.51; Wed, 07 Aug 2019 23:23:06 -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 S1731164AbfHHGUa (ORCPT + 99 others); Thu, 8 Aug 2019 02:20:30 -0400 Received: from mx2.suse.de ([195.135.220.15]:34696 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1731145AbfHHGU3 (ORCPT ); Thu, 8 Aug 2019 02:20:29 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 66B76AF37; Thu, 8 Aug 2019 06:20:28 +0000 (UTC) Date: Thu, 08 Aug 2019 08:20:28 +0200 Message-ID: From: Takashi Iwai To: Wenwen Wang Cc: "moderated list:SOUND" , Jaroslav Kysela , open list Subject: Re: [PATCH] sound: fix a memory leak bug In-Reply-To: <1565241321-2418-1-git-send-email-wenwen@cs.uga.edu> References: <1565241321-2418-1-git-send-email-wenwen@cs.uga.edu> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI/1.14.6 (Maruoka) FLIM/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL/10.8 Emacs/25.3 (x86_64-suse-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 08 Aug 2019 07:15:21 +0200, Wenwen Wang wrote: > > In sound_insert_unit(), the controlling structure 's' is allocated through > kmalloc(). Then it is added to the sound driver list by invoking > __sound_insert_unit(). Later on, if __register_chrdev() fails, 's' is > removed from the list through __sound_remove_unit(). If 'index' is not less > than 0, -EBUSY is returned to indicate the error. However, 's' is not > deallocated on this execution path, leading to a memory leak bug. > > To fix the above issue, free 's' before -EBUSY is returned. > > Signed-off-by: Wenwen Wang Oh, it's a really old bug. Applied now. Thanks! Takashi