Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp1403752ybi; Fri, 2 Aug 2019 15:07:04 -0700 (PDT) X-Google-Smtp-Source: APXvYqyXK4BgQtLRNWvvzm/66bQzkkVkdlBGNSx6bXGMGy8l0f4GdjmCO/jM1Yc+2day+38I/og2 X-Received: by 2002:aa7:8193:: with SMTP id g19mr60193301pfi.16.1564783624066; Fri, 02 Aug 2019 15:07:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564783624; cv=none; d=google.com; s=arc-20160816; b=g2Jf+OyljZBOyI6ubZC7EdfRF6zR0YgI7Te1OU4MyxqVrttT+n7GsxC4Xh/w86sHXV 1gjEiJg7dH47f7FkqLwPw/ku4XxPyL4DaNxkN+rdUCSHuKTsqNr4a/kK3GTNsZY44M7R /sIK6c1gWCZctKptEKuTfC4RdlyzVmQ3OjGp6ipju5pSo49YOgfoHZD+6hLAfVjk89bt VPg1RHQKkXnyBS8IMrlLr69Lpxbv8SE1sh7aKqJhWdnkPBc1f+loL0w3vMz//eZ67PKv 9QTiX0jvi+/2HUG9wI2tq0CCYDzUYRYfmP4sUIfGJgOwWZwRQL8pafAwlft6sSN9MS8p 6BfQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=8QuKcvpKPMrmYZXFNpBd8R0gul96OdkdC6GICMv4gK0=; b=rsbjbCFflSa3AEqDBjQPh8EdY8aKYDQuwyN5gZULnH+dlJ0fKldaEXPPhGIyKF1I0b EEmQH3n2IGqX/ZRT/nnyMTMhaawXooJ5vFvVBZqlqiChy/a3/lUnjvMdh9xzOzm2PDPO jWDndk7fzqaeXkyPeGFUVDoi3tpSn+TZ2qZ0sbe3WC4yMJ1hQ1i8KgYowYBuG9MLVeig mP/R6XS22gNQSA9oz/k5fcG0EZ1uokfYAtGQaZWf/6wpCYZ0hZc04Ng61KS9rMcFnYz6 YvwVnZvPhbMfHcSWypx6TlN2VVPsXGso80esM3UJovQ8c8kTtZRLmFbB5g6TpaiCk44E kW3w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=UH1hQM0G; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c70si40117059pfc.270.2019.08.02.15.06.48; Fri, 02 Aug 2019 15:07:04 -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; dkim=pass header.i=@kernel.org header.s=default header.b=UH1hQM0G; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2392463AbfHBL4v (ORCPT + 99 others); Fri, 2 Aug 2019 07:56:51 -0400 Received: from mail.kernel.org ([198.145.29.99]:52334 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731531AbfHBL4u (ORCPT ); Fri, 2 Aug 2019 07:56:50 -0400 Received: from localhost (unknown [122.167.106.83]) (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 657B72171F; Fri, 2 Aug 2019 11:56:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1564747010; bh=+J34gvcAYkLjRMmKzsumfEwWslDwfUO0ZXmj5OdI3ZA=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=UH1hQM0G+9glJwBtz2BNd0Hvj8jLLpXUKfztFAbZXkwSJwuQIXRAxS1hhxaCOzd4B OjjZjB2XH7ByhDGVZGJSuWP/W6Dg/CQwA+G0TP9+1Q2PXGMywOt7QJS/YPimNHfU65 VuxP6nGxyxOZc/OXDpoTtLVldT5tgS11fLobOWdA= Date: Fri, 2 Aug 2019 17:25:37 +0530 From: Vinod Koul To: Pierre-Louis Bossart Cc: alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, tiwai@suse.de, broonie@kernel.org, gregkh@linuxfoundation.org, jank@cadence.com, srinivas.kandagatla@linaro.org, slawomir.blauciak@intel.com, Sanyog Kale Subject: Re: [RFC PATCH 06/40] soundwire: intel: prevent possible dereference in hw_params Message-ID: <20190802115537.GI12733@vkoul-mobl.Dlink> References: <20190725234032.21152-1-pierre-louis.bossart@linux.intel.com> <20190725234032.21152-7-pierre-louis.bossart@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190725234032.21152-7-pierre-louis.bossart@linux.intel.com> User-Agent: Mutt/1.11.3 (2019-02-01) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 25-07-19, 18:39, Pierre-Louis Bossart wrote: > This should not happen in production systems but we should test for > all callback arguments before invoking the config_stream callback. so you are saying callback arg is mandatory, if so please document that assumption > 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 -- ~Vinod