Received: by 2002:a05:6a10:a852:0:0:0:0 with SMTP id d18csp3774067pxy; Tue, 4 May 2021 09:35:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJycHigFBWvz0Lmx0x5IrpPuTpwe0fReM3l59ohhQZkMG13J+TVqLC1U6wVQSDp4pMB1P6+V X-Received: by 2002:a17:907:3f1c:: with SMTP id hq28mr20899270ejc.349.1620146136900; Tue, 04 May 2021 09:35:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620146136; cv=none; d=google.com; s=arc-20160816; b=QtdsLhrujT7nyxEkLSH88bh3o6++aYlOzfiwlBc5XT5r3Gt+OgMZfg6GXmhOUU9P4K D+8EH/in1FSeYmIOJD55cZsn/5QZcsELbvu/EXoDtAL4EPXIM67zBJjAyy8/D6Ml4GsH m2GWripvpfUb6hKTZiR4R7CenUK6O9i5hzT7JIur5Lp+VpFhRJJAcD+MsEbaydqb00EJ NqrRi2HqikeBIhRyIpKsR/urWCaR/gEKNsEyoP8F/kYLD8AbBAoFpDdMR5YZs236pcjr vNUKiPLqcCA265AwClfcF8gXoAfP3jKgziQwK5Hb6E6P5NP10Q+dujyuU8nm1rokj5WZ aA+A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=1fDCM4gQCDOkdnZPRkfCiUkeyVBn73VbTXvDjN7VVk0=; b=MclDhsJQhvNoEEW/TH8p4RWVTXimWKqDSrtlWfSACVprlyBLAPZKjyZ2hvfWnuv3j0 85/OCXxDl8WbKRZ7fFJNnKaZCyPz1m5UoptNOUeOav2Dc7B9d3Mal6i1n9pn1g+P8tvx vYyyKjicmTECwBPRxPtwzvNFtK8XpnDxyxpsFYH2GNbhqqDB+Lkjz5b6Y814clhYAH6o J1DW0Fzj6KbXrpoQnmiefLGtgnPXXD6bapjklMw4cbUOXNF4DN8ziNk/qBnV0oZ7gmEy 77/ju5NF7ZatFwQgEal+Ph7U80qOr5/+GirrgzivQ4tu154Cl86Vno5Q2ncM4B/tBcw0 4EOg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=CDz28VDa; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id t28si12053949edy.343.2021.05.04.09.35.13; Tue, 04 May 2021 09:35:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=CDz28VDa; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231724AbhEDQc2 (ORCPT + 99 others); Tue, 4 May 2021 12:32:28 -0400 Received: from mail.kernel.org ([198.145.29.99]:53822 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231651AbhEDQcX (ORCPT ); Tue, 4 May 2021 12:32:23 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 0758F61153; Tue, 4 May 2021 16:31:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1620145888; bh=HEoVuMMyCorXHFHNK57tOLdo4fFFRxsjN8iPfCi0MYM=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=CDz28VDaiBdh+oS+J5Hsd7fdo1jci0IMZDJ/78vzOaTYIpFTFWonccp5UolZUNCWk i9kQGE58djvjdWNpWYPLvR0ZLq0YpfB9wQxY/qgyXXT8ov64V1js+MoGqO3V4JtIMK 94PmOzqRmWFRQz0vnVhdaBQfDDgBg17v0KB5nNnY= Date: Tue, 4 May 2021 18:31:26 +0200 From: Greg Kroah-Hartman To: Takashi Iwai Cc: Jaroslav Kysela , linux-kernel@vger.kernel.org Subject: Re: [PATCH 37/69] ALSA: usx2y: check for failure of usb_alloc_urb() Message-ID: References: <20210503115736.2104747-1-gregkh@linuxfoundation.org> <20210503115736.2104747-38-gregkh@linuxfoundation.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, May 04, 2021 at 10:27:34AM +0200, Takashi Iwai wrote: > On Mon, 03 May 2021 22:33:52 +0200, > Jaroslav Kysela wrote: > > > > Dne 03. 05. 21 v 13:57 Greg Kroah-Hartman napsal(a): > > > While it is almost impossible to hit an error calling usb_alloc_urb(), > > > to make systems like syzbot which does error injection, and some static > > > analysis tools happy, properly handle errors on this path by unwinding > > > the previously allocated urbs and freeing them. > > > > Perhaps, I miss something, but this revert and add the cleanup to the wrong > > place makes things worse: > > > > The usb_stream_free() is called when init_urbs() fails (returns an error), so > > all urbs are freed there and pointers are reset to NULL. Your code frees urbs > > twice on an allocation error. > > > > The reverted code does the job better. > > Right, the suggested patch will cause the double-free, and the > reverted code is fine in this regard. That wasn't obvious at all, sorry about that. > In anyway, the cleanup of this driver code is on my post-15.3 TODO > list. So, Greg, could you drop the revert and the additional fix at > this round for usx2y driver? Ok, will drop the revert and this patch, thanks for the review and sorry for the noise. greg k-h