Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp1146338pxv; Fri, 9 Jul 2021 19:29:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxtwqxLneU7KrF0LKS0KEO124JG3lsyZWr3xtnSI2J9yKiyuYm08+MBSNejRwAyEw44YJX7 X-Received: by 2002:a05:6402:4243:: with SMTP id g3mr7615505edb.85.1625884160591; Fri, 09 Jul 2021 19:29:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1625884160; cv=none; d=google.com; s=arc-20160816; b=AkTGhZbNn4lVZnfMR/JUNyO1obthB2arYlfIBEGTGKXu+K/dicqoWETYF27+JcqMzE xqeYNlOL6VM2/s8TudeaYVIYoE6CqVkT3ncoLxn8N6WV4hgaqREChxmwYJhQbgSwJDUT qtqGdoSoedL7wIGf/5rmQZljk8HzUygDZdcMW3QYuyCelEzt90HN6s1FoK4Cuq1+grlc yP9EBRdVdS3dLpXGm1zhfBu3pyglEYIoGvUccuPmtDHRvmjTwK1TIeVqe55Ia0gnZgV7 d4E9qyr90OTwrHknSD7QCRGxTUVsC8B1Ll8Uh3zDzyQ4gXlqDNilr76m5SZLR+H1Zgf9 xdqQ== 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=wlNq9YALUzLGNjWc/ywyI3Y9CGol1IQHIhwB8GysWyLubg4zTKGxMWPCrFaIU8toB3 r0ZbUHGgFyTG7ioLo9lRQ0ctF5jPYW6nK3eBsKyW8jyNIXycQwdKbw9wfaxj/hHsm7+S E0KNWhAoMD/ahyJkL/okl2vkt6aEuONZEl4ziQogOYB/hhqPNPButjqQ12Az7r7urdSf YyXdLmWgGnj6HU803ILp952g4hGFtc/bMsSoWVisX50TMHGgBycpms848W7NBo0RUctv vbPvufzNa/5JMwZQoFfnF4//xC2GSLkyHy7MbLMayp+xMcHVukZsB+H6aNVPukvokSXg U/jA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=h17jTR+0; 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 oz36si7579178ejc.144.2021.07.09.19.28.57; Fri, 09 Jul 2021 19:29:20 -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=h17jTR+0; 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 S233904AbhGJCaq (ORCPT + 99 others); Fri, 9 Jul 2021 22:30:46 -0400 Received: from mail.kernel.org ([198.145.29.99]:42882 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233799AbhGJC2E (ORCPT ); Fri, 9 Jul 2021 22:28:04 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 088C2613ED; Sat, 10 Jul 2021 02:24:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1625883893; bh=PFPsC1bwNfkre24GbZAloHDyURgIzkgS9yrhCz7qWhA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=h17jTR+0rbrLhs31i+6KgY6xnoEGFiAJr5dSjopSLnXo/UV3frhT835HIv0J/51pt uXbzc0d6FCbtot4XuLTlU39LMUajOp80+UDdPWGpj4rAz0j2jjDi/zP3cRV8oI2uO9 yArw3fmhC0cz/1FtJsKK6OlBScFs7u4tSkSIwGm/lUHcIlMvv4oXd8GxnDTXgm/xCi NBfeXiTQua2o5YZuJAEjTlwlmETUoVWA5oYE/CMCDW6AgfYfn9S1U10iqu5cSPvp8+ XMzpFHmff6H2l6norTzEXcmfDBfMu6PVksRJeYdMGuFIFtYOm3JQnGkzu358PWAdOC JzA7EDiBBON3A== 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.10 18/93] ALSA: usx2y: Don't call free_pages_exact() with NULL address Date: Fri, 9 Jul 2021 22:23:12 -0400 Message-Id: <20210710022428.3169839-18-sashal@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210710022428.3169839-1-sashal@kernel.org> References: <20210710022428.3169839-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