From patchwork Fri May 1 13:21:29 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 226517 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=-6.8 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable 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 35E67C47258 for ; Fri, 1 May 2020 13:56:03 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 05EB12054F for ; Fri, 1 May 2020 13:56:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1588341363; bh=YrxMlGyE2KviOK/T4PJpqUfrpehNPI0Nxsxq2VcoJgw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=Ar27L++RuK8n/oM1393iTBvdnanmRip3boSafbDKZzPWApYT8w7Y6RnUterPS8Ap6 B/xOg447oVM/Ta9ryi/BpMh1MB+Co9cDnXt318dTDcsG28XwaRDtIMmS3+TFMIVGuL x0Nc8q2PCUARq5pl1dnyMFfy43ElZKRlVgXdMaZQ= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730302AbgEANzy (ORCPT ); Fri, 1 May 2020 09:55:54 -0400 Received: from mail.kernel.org ([198.145.29.99]:58806 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729891AbgEANdT (ORCPT ); Fri, 1 May 2020 09:33:19 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id BB54B2173E; Fri, 1 May 2020 13:33:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1588339999; bh=YrxMlGyE2KviOK/T4PJpqUfrpehNPI0Nxsxq2VcoJgw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ysKmNiyQMOFRHfbt2C0hdPd/mG5n74Mx/ggJ26D6kRsVuj3eDMAejFeZGSwQNiZHo I8mK1zngw5Y5et8DsEdVX4AzYvQRRs23ob3t9tLR5+AzQpkXWL6vN4wcOs9AkXMbvh ZMw7tkXKkqJMb7u+2Rcapj8KEbKV2Y3vS6qjuXho= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Lin Yi , Takashi Iwai Subject: [PATCH 4.14 053/117] ALSA: usx2y: Fix potential NULL dereference Date: Fri, 1 May 2020 15:21:29 +0200 Message-Id: <20200501131551.358714779@linuxfoundation.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200501131544.291247695@linuxfoundation.org> References: <20200501131544.291247695@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Takashi Iwai commit 7686e3485253635c529cdd5f416fc640abaf076f upstream. The error handling code in usX2Y_rate_set() may hit a potential NULL dereference when an error occurs before allocating all us->urb[]. Add a proper NULL check for fixing the corner case. Reported-by: Lin Yi Cc: Link: https://lore.kernel.org/r/20200420075529.27203-1-tiwai@suse.de Signed-off-by: Takashi Iwai Signed-off-by: Greg Kroah-Hartman --- sound/usb/usx2y/usbusx2yaudio.c | 2 ++ 1 file changed, 2 insertions(+) --- a/sound/usb/usx2y/usbusx2yaudio.c +++ b/sound/usb/usx2y/usbusx2yaudio.c @@ -689,6 +689,8 @@ static int usX2Y_rate_set(struct usX2Yde us->submitted = 2*NOOF_SETRATE_URBS; for (i = 0; i < NOOF_SETRATE_URBS; ++i) { struct urb *urb = us->urb[i]; + if (!urb) + continue; if (urb->status) { if (!err) err = -ENODEV;