Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp1145100pxv; Fri, 9 Jul 2021 19:26:45 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwZdxFRorgkwsWjhZwdhXACGNB6SYPa+vMySSDB7rF37oY9jc6w3pmPCsYJ0Rgvp/G7k1+N X-Received: by 2002:a17:906:31d4:: with SMTP id f20mr39431332ejf.383.1625884005544; Fri, 09 Jul 2021 19:26:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1625884005; cv=none; d=google.com; s=arc-20160816; b=sQ2uVox1CjDeTvhO/rEW0k+zAxNMXuzOV550hdP5Kf6LINIsWQEqyZuB5IPdjFQ718 KJbvtYX/7uPqLlyVZ3ApL5zZtpAcECe2irwJ+ci3SCrBxGA6le8nzDOIVee/IhG7QYcU MbDUxjJmMnAFf3TBoucUD+EqLgSx4guaK07qA3lOInvOt4chrB1hPbKt9akJvY05+Q2f a7w7u+6ZRExuApgZe1yEQhBGU76z6EnmWX/Fe34MIJwdL1fTfHEJfg5NGidVfPpKjc9q UmId6P0vZk3oGJU15F/z6XBG9DwH+7qiBmt2723H9eECue4fkti0RmbXJFzBTJ9257AA z7AA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=TztpfSmk6vjgnswY3zYLAqDBGh0s7LJ2Iprq15ZJCGw=; b=vm7DADW/ghUXjz10dfOjzC4b+HNANTIP6pSz6wzuVO9MoN6nD46EvVSrcGUsY6f9Sm mAXzWGeko7jJCsSrgO9XOo84/lNDHiDfbEwnOzKGg3ynQI/Ck4y8xkrd1IbgqWOO5v4u //CzHDvtX0ubs8GUb4u350kmhpucxJXxMCBWZpOLR4ziZVHB8tCpWR1QuUffcpb9bOPX 5TG49fFp54GTYKfMWgX2IzPq1RGvm/EezxjBq2urpKhc1Ay6UNi9m7OK6kQ48NbHJ1xK fZCXTl69wY02bgKSZwxqnQVKdCZyZSqmVSKmiRhiLLiSxbfBeYaRZGPG56rf8F/S7QD5 QFMw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=jEr88u5a; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h1si8885127ejf.146.2021.07.09.19.26.22; Fri, 09 Jul 2021 19:26:45 -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=@kernel.org header.s=k20201202 header.b=jEr88u5a; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232868AbhGJCZg (ORCPT + 99 others); Fri, 9 Jul 2021 22:25:36 -0400 Received: from mail.kernel.org ([198.145.29.99]:41714 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232645AbhGJCZH (ORCPT ); Fri, 9 Jul 2021 22:25:07 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 831CB613D4; Sat, 10 Jul 2021 02:22:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1625883743; bh=PFPsC1bwNfkre24GbZAloHDyURgIzkgS9yrhCz7qWhA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jEr88u5ah6PhPpvwkppDrjMJXC0WIU2lgX/aytilOmfnlB49PSJnllrKwuOvWdDXj WMXAdNFindvS9y8I4L/dlKMiz5UzjB6F+g+xOFkLTY/4f8XCB4n0cSl55vNSTMVWlg 1+yqYITee7Ze0IqJNcnG6suImm9SwYh2jbAsF6M8+7tJOh1GOq2ALKUp6XsnZnMRiG NU+x6yiIR2rZkZQAauyJ+cVgt2GM91026wx0u/BOnN1omvcF6/8fzBhLoHW71+sWH5 OZF4v1Ygb5dwmmr5rEIydfq1uRAgUE0D09NNxlDEPS8EIUxp6zc7lGzr6YkvSB0/0q D7ZUXt9NuVR2Q== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Takashi Iwai , Sasha Levin , alsa-devel@alsa-project.org Subject: [PATCH AUTOSEL 5.12 020/104] ALSA: usx2y: Don't call free_pages_exact() with NULL address Date: Fri, 9 Jul 2021 22:20:32 -0400 Message-Id: <20210710022156.3168825-20-sashal@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210710022156.3168825-1-sashal@kernel.org> References: <20210710022156.3168825-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Takashi Iwai [ Upstream commit cae0cf651adccee2c3f376e78f30fbd788d0829f ] Unlike some other functions, we can't pass NULL pointer to free_pages_exact(). Add a proper NULL check for avoiding possible Oops. Link: https://lore.kernel.org/r/20210517131545.27252-10-tiwai@suse.de Signed-off-by: Takashi Iwai Signed-off-by: Sasha Levin --- sound/usb/usx2y/usb_stream.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/sound/usb/usx2y/usb_stream.c b/sound/usb/usx2y/usb_stream.c index 091c071b270a..cff684942c4f 100644 --- a/sound/usb/usx2y/usb_stream.c +++ b/sound/usb/usx2y/usb_stream.c @@ -142,8 +142,11 @@ void usb_stream_free(struct usb_stream_kernel *sk) if (!s) return; - free_pages_exact(sk->write_page, s->write_size); - sk->write_page = NULL; + if (sk->write_page) { + free_pages_exact(sk->write_page, s->write_size); + sk->write_page = NULL; + } + free_pages_exact(s, s->read_size); sk->s = NULL; } -- 2.30.2