Received: by 2002:ab2:3141:0:b0:1ed:23cc:44d1 with SMTP id i1csp611810lqg; Fri, 1 Mar 2024 15:42:48 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUE1yx5F0spyemH3Z9gd8+SFXtOZHYnIFClwRJcOlj4hdnvg9GnajRsDlLQi3a3kc/VhiehVRQq/hDXSf/ugGlJRRpbIYdHO9N4bqanSQ== X-Google-Smtp-Source: AGHT+IGMhK/a0sm+2AWDb61ir7pkrWr4Titc7OJfg23yDxbj8hX0nCZu51l0eov9ETjWPaCcixWJ X-Received: by 2002:a05:6830:1108:b0:6e4:7d50:3ad2 with SMTP id w8-20020a056830110800b006e47d503ad2mr3234938otq.11.1709336567936; Fri, 01 Mar 2024 15:42:47 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709336567; cv=pass; d=google.com; s=arc-20160816; b=TpekEiKmcAnsXuU6/P9iD9jhezqgTRttp21LvAxsse1QaOV1OovKOZQGgAyxzgaywV grJQWuDqawg215Sc+8n8TDa03GlIDdaZYbpOZfAywMf/cKG+qzJ1DY7j+OiAHDtHOtBg X4d/mAfLdxvTZr0NBGEr6/J9I9McdZYDZM/CkDJjp88uS2HR4KuY2pr2bQXNblHRj6zP 1HTAB0C4wEeOBazfyzQqgWoJAkv9UN5eaWEsyfdq1cxWwnZbBbqFO2FqzCOmtxbYbIYf c5CRz9EJkDmIFncRH5HO+y0M6CqOu+Jw9zNzMpHpB7Y1EQvDHXkzI3G0iF38G03lEyd2 oRBQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:autocrypt:from:references:cc :to:content-language:subject:user-agent:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:date:message-id :dkim-signature; bh=QTpk9ZPQWyNrhHVW/3ykx8bCWFEXW6TZCcUdpJn/0yY=; fh=kXuGZwitaDmNP6AjNRMeNuHfQNl5OD5lH98tv40vn9g=; b=ZHz3TxQ5IZ6rYZHajXEBtl2JpqydjRC6faFEqbnAq57lUYuHfh7+J8YZUdbAO+YvW8 8fe81iZH45BiFJRaL3oDon+Gd0X1hcQWypOGo2ADgZuhkrn9t+h3eMeSyOxdvXNwGWkw gxOmIQT0+7YPBXlw9HhcPM8Qewk35DjSPq4lvdVKCQwKgivFgvDApLGQgGNk5fm7Xs0F YO/LQ2khCZpxs94SIo/aYhtuqoozHrIRyeNsfJf9SU8X3Y1Dah70x40Ht7+/bh8+9rkU GnfRdv6X0kcAx2j4w5km1O7NOnVx1lTnrOBFRIx6Y0o3+7D0xae1KS9swyt8TkmM61K0 1Veg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=eYleZ5U5; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-89231-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-89231-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id j36-20020a63fc24000000b005dc4baf54desi4310725pgi.769.2024.03.01.15.42.47 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Mar 2024 15:42:47 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-89231-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=eYleZ5U5; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-89231-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-89231-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id AA14FB21DED for ; Fri, 1 Mar 2024 23:42:40 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D532358AA4; Fri, 1 Mar 2024 23:42:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="eYleZ5U5" Received: from mail-ed1-f46.google.com (mail-ed1-f46.google.com [209.85.208.46]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 682DF3C48C for ; Fri, 1 Mar 2024 23:42:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.46 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709336551; cv=none; b=Vm4XNBer0T0xiJoEqG9eK1DsjzE3GU1QSerIiCDEaEuNT4Q7AWM0lumNEE2kaXJdZhcHKvDON0dsLjQty5s6fOljbzbIeiXElMNg4GjomSJmO9OQ+NU+SuXzJrrKsDd6UIBQrYsZ9NO4oICy9r7XXLqz7WWsYGsS5FWAjdSSkRw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709336551; c=relaxed/simple; bh=25h2s03QLSdp6bRNpLiP+irXeh+fZcWx//JXhu+B3aE=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=W/bJO7C4k6OJFGXMK9GSoptYivjWxYDyf999j7cWUjfw8qonEWGUi9l3MXLpnlcMYKSwrlQK0VUrdqQ4OV8Ub5VjM/p1lxND6Cy9rHNf0nx7OaGwZtzZL9rQDPrTcwAjwLzQXhX8kSs1YNrR9COBymw38/jSAQWvpFwrhv0Kv70= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=eYleZ5U5; arc=none smtp.client-ip=209.85.208.46 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Received: by mail-ed1-f46.google.com with SMTP id 4fb4d7f45d1cf-566df43a1f8so1530107a12.0 for ; Fri, 01 Mar 2024 15:42:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1709336548; x=1709941348; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:autocrypt:from:references:cc :to:content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=QTpk9ZPQWyNrhHVW/3ykx8bCWFEXW6TZCcUdpJn/0yY=; b=eYleZ5U5uRz4CbzUtw5H0NJ1TRU8JZzL3x39w306wijfF4ZNzoAO9lE5J6Tsbi6zIf W6LdUSET5UTCqscTpETnnVcudqEso2Ox7dSOobgvIrK4nb9BPAlHEbR1gDy8LreGp7pl EwjcDBdmoqFA6SXVx6Q8jalNnUDcm257Lgh09fDmse0Wn+Vur3NeW0r/vDFtm23JetcS 1MPbMOBEOXgp1NPmb4EJ5xAkHXxui4sCMW7x+COfd3VDP3g8+B4r2vxjmpkTibTcjN7l 2mMcRFEF1dUZ4d3UioqUHWEXFzxOcWXSuuuVwyHvu673uBS6sFdHsAmR5s1yPpzx2VDC kebQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709336548; x=1709941348; h=content-transfer-encoding:in-reply-to:autocrypt:from:references:cc :to:content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=QTpk9ZPQWyNrhHVW/3ykx8bCWFEXW6TZCcUdpJn/0yY=; b=O4E9rHFBufmHHUX8sMTMgbyzNDmIDe/hDVFp7/RhjbF1EHWXEImqjjCuXM4VY62dp3 B45e+7BF2WYuizBX9IgZ5I23X64bIlS8UWDx3663dh0znAzLA0LYUJC8LdYtUJq6W784 PBq5DBCOoxifFYQHzLK92/FlRu3bCCKaUSDtR8V3FQ4uvEKaV3fKHD/EFay4cT1rujP5 PHkbZNlgb9Q4Joli7LuWSXWisQisddDb2Uow36jBxy95ae2s0SGdh01T5ttuR3RPTg2E c5oi51E5IStGlZU15xL/qQ0wexKN6wkY0qT+zS1RxJ1IsEMkHQlMvyUorNLBJYjqwQEP CRnQ== X-Forwarded-Encrypted: i=1; AJvYcCW6zFKhaYkP8n8SFtoe2rNzVJFe30+JctTMZ6sXBc4YWn6fY1IHbtuc35npcbw2c1s0eeXqxh/Hwsm4rLqWgH71OmXiCVn6QTGkXHJU X-Gm-Message-State: AOJu0Yx/aTHWpM/h+mQcYxPy+w1qFeVBxcpicTlVm1Ke4WJHAnA043Ki dPoa1BASun84EfkBsr79+Jx4lLOtj8j9YfDLeN+7OSMUphNYFxIdsKQC1QugHAY= X-Received: by 2002:a50:c8c9:0:b0:566:348:fc4a with SMTP id k9-20020a50c8c9000000b005660348fc4amr2195978edh.32.1709336547817; Fri, 01 Mar 2024 15:42:27 -0800 (PST) Received: from [192.168.216.32] (078088045141.garwolin.vectranet.pl. [78.88.45.141]) by smtp.gmail.com with ESMTPSA id c28-20020a50d65c000000b00565a9c11987sm2077259edj.76.2024.03.01.15.42.26 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 01 Mar 2024 15:42:27 -0800 (PST) Message-ID: <77485a55-c9da-408f-8dcc-77c6734927da@linaro.org> Date: Sat, 2 Mar 2024 00:42:26 +0100 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v12 8/9] firmware: qcom: scm: Add check to prevent Null pointer dereference Content-Language: en-US To: Mukesh Ojha , andersson@kernel.org Cc: linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, linus.walleij@linaro.org, linux-gpio@vger.kernel.org References: <20240227155308.18395-1-quic_mojha@quicinc.com> <20240227155308.18395-9-quic_mojha@quicinc.com> From: Konrad Dybcio Autocrypt: addr=konrad.dybcio@linaro.org; keydata= xsFNBF9ALYUBEADWAhxdTBWrwAgDQQzc1O/bJ5O7b6cXYxwbBd9xKP7MICh5YA0DcCjJSOum BB/OmIWU6X+LZW6P88ZmHe+KeyABLMP5s1tJNK1j4ntT7mECcWZDzafPWF4F6m4WJOG27kTJ HGWdmtO+RvadOVi6CoUDqALsmfS3MUG5Pj2Ne9+0jRg4hEnB92AyF9rW2G3qisFcwPgvatt7 TXD5E38mLyOPOUyXNj9XpDbt1hNwKQfiidmPh5e7VNAWRnW1iCMMoKqzM1Anzq7e5Afyeifz zRcQPLaqrPjnKqZGL2BKQSZDh6NkI5ZLRhhHQf61fkWcUpTp1oDC6jWVfT7hwRVIQLrrNj9G MpPzrlN4YuAqKeIer1FMt8cq64ifgTzxHzXsMcUdclzq2LTk2RXaPl6Jg/IXWqUClJHbamSk t1bfif3SnmhA6TiNvEpDKPiT3IDs42THU6ygslrBxyROQPWLI9IL1y8S6RtEh8H+NZQWZNzm UQ3imZirlPjxZtvz1BtnnBWS06e7x/UEAguj7VHCuymVgpl2Za17d1jj81YN5Rp5L9GXxkV1 aUEwONM3eCI3qcYm5JNc5X+JthZOWsbIPSC1Rhxz3JmWIwP1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ShwL0MLSC1KL1lXGXeRM 8arzfyiB5wJ9tb9U/nZvhhdfilEDLe0jKJY0RJErbdRHsalwQCrtq/1ewQpMpsRxXzAjgfRN jc4tgxRWmI+aVTzSRpywNahzZBT695hMz81cVZJoZzaV0KaMTlSnBkrviPz1nIGHYCHJxF9r cIu0GSIyUjZ/7xslxdvjpLth16H27JCWDzDqIQMtg61063gNyEyWgt1qRSaK14JIH/DoYRfn jfFQSC8bffFjat7BQGFz4ZpRavkMUFuDirn5Tf28oc5ebe2cIHp4/kajTx/7JOxWZ80U70mA cBgEeYSrYYnX+UJsSxpzLc/0sT1eRJDEhI4XIQM4ClIzpsCIN5HnVF76UQXh3a9zpwh3dk8i bhN/URmCOTH+LHNJYN/MxY8wuukq877DWB7k86pBs5IDLAXmW8v3gIDWyIcgYqb2v8QO2Mqx YMqL7UZxVLul4/JbllsQB8F/fNI8AfttmAQL9cwo6C8yDTXKdho920W4WUR9k8NT/OBqWSyk bGqMHex48FVZhexNPYOd58EY9/7mL5u0sJmo+jTeb4JBgIbFPJCFyng4HwbniWgQJZ1WqaUC nas9J77uICis2WH7N8Bs9jy0wQYezNzqS+FxoNXmDQg2jetX8en4bO2Di7Pmx0jXA4TOb9TM izWDgYvmBE8= In-Reply-To: <20240227155308.18395-9-quic_mojha@quicinc.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 27.02.2024 16:53, Mukesh Ojha wrote: > There are multiple place in SCM driver __scm->dev is being > accessed without checking if it is valid or not and all > not all of function needs the device but it is needed > for some cases when the number of argument passed is more > and dma_map_single () api is used. > > Add a NULL check for the cases when it is fine even to pass > device as NULL and add qcom_scm_is_available() check for > cases when it is needed for DMA api's. > > Signed-off-by: Mukesh Ojha > --- Most (all?) drivers calling into SCM already check is_available() at probe time. I'm not sure returning -EPROBE_DEFER would be good for calls outside .probe. Konrad