Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp2658688pxa; Mon, 17 Aug 2020 15:45:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxzW8wa7AW/aW6sHWWwptD3eei6M+7Xr8ckFYllTTczUe70sY6ZVe2KfTQNT8tWp97gq40q X-Received: by 2002:a17:906:6bc9:: with SMTP id t9mr16769290ejs.372.1597704347828; Mon, 17 Aug 2020 15:45:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597704347; cv=none; d=google.com; s=arc-20160816; b=yGNeX3gwf4cW3wtC63xZ3dqX63rF2TlvhtcEU4lSEm6v0/yJIdAAxcd1bAO8dpkDYf ypNJ33ab9r6LwOgerIHAwdTSTM3sPvB63cIqCVsjeYH1XO2vxItL8INnlrQzVhjmAxZH AgCrpdeFpTEbSDs0nC4ft/GI+J+XuRI33gkVGzh8QyQ5VaaMGh8doAElr5Qm8QQ3+OFd enauVEvTQbeHkPm9UXz79B7aXnHzA0i+EvIONY0MxT0hRQEndY/q/U7Th2m2EbLJ69o1 8ak490f6Bj6TaFsh2soWz40l3G2N1dbhQhvA0zc8vTgMY0ushjkiJc3Vt0ysaWZjSaSm 6jhA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=hy9w6vKY7fYEsNH6+ZWQhkX40yflBzNIUpcI/A/XlCo=; b=mjKpC438bm+t/7PgjFZUr6En7jdpHicNlwe3c9iwiQM1KzDq3lLo/qZ6KHjUmHeeCu ZRgi5WSR0NmEv+Ujsn4wJwHrwe/5Upc40ZhpcgSlZT73jVg5B3yy/p5snNb6+oJYBUy7 kyfdI9mw5Xyx4u3VdISQFmKMaIuql9ZY9UOhFwFEUv6rxsawoYKOSDF/wXQt7YTWJZc4 XcVRvjf9McH8Immi8LnaUjQEF0dvAnQlIWHP0VSsGRLiPt8Q7NLrWmkopOWoOx3MA5nX smYJDlCyi5cnVzbWlLpT1OnXzXWSNlqSqWOYRxEcLQ9f93IbQ+b64EvWVOTJ62m6vk9Y 9vvQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=rc+qfE14; 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=fail (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 a23si11790203edx.271.2020.08.17.15.45.24; Mon, 17 Aug 2020 15:45:47 -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=default header.b=rc+qfE14; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2391842AbgHQS7L (ORCPT + 99 others); Mon, 17 Aug 2020 14:59:11 -0400 Received: from mail.kernel.org ([198.145.29.99]:60972 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387414AbgHQPsp (ORCPT ); Mon, 17 Aug 2020 11:48:45 -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 55D872067C; Mon, 17 Aug 2020 15:48:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1597679325; bh=C8HJY6mzlMYJgOJb/37DmfGgi7e8IQV70Tp3hB3M2jk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rc+qfE14BVCsrJkLy/5PVlqzfXBwP6Sodfj9akvfScHMndvm3VJTZOAwOdJEXUxqK 5dvayqCqqh7LCrHEuSfXK8975AqxoWjclXC9BoqM15zvv1BnYqoyTZuJi5hyCESKWs HmFW3PEHY4j6K3Q4WO1gcQjIMJycmP056W93k+Uc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Colin Ian King , Sasha Levin Subject: [PATCH 5.7 155/393] staging: most: avoid null pointer dereference when iface is null Date: Mon, 17 Aug 2020 17:13:25 +0200 Message-Id: <20200817143827.135155225@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200817143819.579311991@linuxfoundation.org> References: <20200817143819.579311991@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Colin Ian King [ Upstream commit e4463e49e29f43eecec86e2e2b2e2ab4feb7d867 ] In the case where the pointer iface is null then the reporting of this error will dereference iface when printing an error message causing which is not ideal. Since the majority of callers to most_register_interface report an error when -EINVAL is returned a simple fix is to just remove the error message, I doubt it will be missed. Addresses-Coverity: ("Dereference after null check") Fixes: 57562a72414c ("Staging: most: add MOST driver's core module") Signed-off-by: Colin Ian King Link: https://lore.kernel.org/r/20200624163957.11676-1-colin.king@canonical.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/most/core.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/most/core.c b/drivers/most/core.c index f781c46cd4af9..353ab277cbc6b 100644 --- a/drivers/most/core.c +++ b/drivers/most/core.c @@ -1283,10 +1283,8 @@ int most_register_interface(struct most_interface *iface) struct most_channel *c; if (!iface || !iface->enqueue || !iface->configure || - !iface->poison_channel || (iface->num_channels > MAX_CHANNELS)) { - dev_err(iface->dev, "Bad interface or channel overflow\n"); + !iface->poison_channel || (iface->num_channels > MAX_CHANNELS)) return -EINVAL; - } id = ida_simple_get(&mdev_id, 0, 0, GFP_KERNEL); if (id < 0) { -- 2.25.1