From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C1D8BC433E0 for ; Thu, 4 Feb 2021 06:41:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 86CF164DF2 for ; Thu, 4 Feb 2021 06:41:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232793AbhBDGlS (ORCPT ); Thu, 4 Feb 2021 01:41:18 -0500 Received: from mx2.suse.de ([195.135.220.15]:60686 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230311AbhBDGlR (ORCPT ); Thu, 4 Feb 2021 01:41:17 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 3B322AC97; Thu, 4 Feb 2021 06:40:36 +0000 (UTC) Date: Thu, 04 Feb 2021 07:40:35 +0100 Message-ID: From: Takashi Iwai To: Xu Wang Cc: perex@perex.cz, tiwai@suse.com, alexander@tsoy.me, e.burema@gmail.com, alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] ALSA: usb-audio: endpoint : remove redundant check before usb_free_coherent() In-Reply-To: <20210204020518.76619-1-vulab@iscas.ac.cn> References: <20210204020518.76619-1-vulab@iscas.ac.cn> 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 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 04 Feb 2021 03:05:18 +0100, Xu Wang wrote: > > usb_free_coherent() is safe with NULL addr and this check is > not required. The check there isn't about NULL buffer or not; instead it checks whether the buffer was allocated for each or it shares the single buffer (for sync endpoints). In the latter case, your patch will lead to double-free. thanks, Takashi