Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp11446895ybi; Thu, 25 Jul 2019 16:46:40 -0700 (PDT) X-Google-Smtp-Source: APXvYqxZ2TTmw+/Fpr4kzAlas0o01NZqRZ6f7wzeDaH/bvWmpabL+KCNzR1tN61U0J24F5wPDWpS X-Received: by 2002:a63:c750:: with SMTP id v16mr72039121pgg.320.1564098400444; Thu, 25 Jul 2019 16:46:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564098400; cv=none; d=google.com; s=arc-20160816; b=wmWt4wh5zVN+jDVaPEHVsr6O+rbf1QKV+VlNagPVJHhR7KYwv2fnB8K2eGJPUCkvNL ZmvJR5Il+7wiDxDh/FhqXqzVqWsnhaS21gnyotdmi8sQoU/4lhpLcCyT5F0HFqHxNu/N Wq9+9NLa9BbNn+h7b/I71LOqLDEwe/sDJ7YmOOY1Jhr0DjHTaZ7tqIrWxy5NtJSldIUF sJof+Nm3lZFMhkTU4IPRjN+rLdHgNGOdN3OHHhVtIfqhMUFDLocMzvRyMGf+MWmfw9cF yDq9mYMfoh/aAgOFurX7idif3v/yK87sJbbx7hnb66YRg++vWCcoZmNhXWpBpqForwuI Q6MQ== 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 :references:in-reply-to:message-id:date:subject:cc:to:from; bh=Q1CzO4SpnW1qovBEECoknJiOWjv6PnUW2IXWeM2o4v8=; b=X2kPmHInUhoz9bgnv+Plc74Tjxdo2nuFmCHvl5LEUvp+SBRUqKB6PXMIlVoxCHiNZH 8ywRXOqTB6z2lTPnwdSIKyIAR9jJ/zPOOg+FmgNgnWB9Mx7oirCEivqF7Ipe2m+58pS/ 4dNWgJFuqPL17YQjvAqRKR7/3xMp5Ok1ifV7ZrgMycMmC7uGCGbGPjmINqkgOm0lGtPO Zqw0Lt1KiBQZTqwCeBcfguQdcYkx32pd1cFG9ax5gG0vewedaUdcALmKQBQpN6fPpI/g KEk16Fgti5/yYvJoMqUt59hZc+DidORdanO5jHk5Vc3S25Bg0GvnlsVKCBZI9z83mGdu hlQg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o21si16319423pll.169.2019.07.25.16.46.25; Thu, 25 Jul 2019 16:46:40 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727498AbfGYXnf (ORCPT + 99 others); Thu, 25 Jul 2019 19:43:35 -0400 Received: from mga06.intel.com ([134.134.136.31]:51808 "EHLO mga06.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727111AbfGYXlK (ORCPT ); Thu, 25 Jul 2019 19:41:10 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 25 Jul 2019 16:41:08 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,308,1559545200"; d="scan'208";a="369874656" Received: from amrutaku-mobl1.amr.corp.intel.com (HELO pbossart-mobl3.intel.com) ([10.255.230.75]) by fmsmga006.fm.intel.com with ESMTP; 25 Jul 2019 16:41:07 -0700 From: Pierre-Louis Bossart To: alsa-devel@alsa-project.org Cc: linux-kernel@vger.kernel.org, tiwai@suse.de, broonie@kernel.org, vkoul@kernel.org, gregkh@linuxfoundation.org, jank@cadence.com, srinivas.kandagatla@linaro.org, slawomir.blauciak@intel.com, Pierre-Louis Bossart , Sanyog Kale Subject: [RFC PATCH 06/40] soundwire: intel: prevent possible dereference in hw_params Date: Thu, 25 Jul 2019 18:39:58 -0500 Message-Id: <20190725234032.21152-7-pierre-louis.bossart@linux.intel.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190725234032.21152-1-pierre-louis.bossart@linux.intel.com> References: <20190725234032.21152-1-pierre-louis.bossart@linux.intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This should not happen in production systems but we should test for all callback arguments before invoking the config_stream callback. Signed-off-by: Pierre-Louis Bossart --- drivers/soundwire/intel.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/soundwire/intel.c b/drivers/soundwire/intel.c index 68832e613b1e..497879dd9c0d 100644 --- a/drivers/soundwire/intel.c +++ b/drivers/soundwire/intel.c @@ -509,7 +509,7 @@ static int intel_config_stream(struct sdw_intel *sdw, struct snd_soc_dai *dai, struct snd_pcm_hw_params *hw_params, int link_id) { - if (sdw->res->ops && sdw->res->ops->config_stream) + if (sdw->res->ops && sdw->res->ops->config_stream && sdw->res->arg) return sdw->res->ops->config_stream(sdw->res->arg, substream, dai, hw_params, link_id); -- 2.20.1