Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp4416735pxa; Mon, 10 Aug 2020 08:35:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJybbaCck5iD8NN3tQVK1QOADlPgTUvHTKmwQ5BPK/THAbgU6qwTdGCfH5F3nxpEwkRmRcko X-Received: by 2002:aa7:d1cb:: with SMTP id g11mr21349294edp.26.1597073740215; Mon, 10 Aug 2020 08:35:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597073740; cv=none; d=google.com; s=arc-20160816; b=FLaeJCQdLPDpjAn002GPuQkVzm2+16kSCkfFCQyArZi2Hq8/HTmaQlV0QfHpg34YWh TWgbRGQOOItwVec6rSXb6DtYgCC/0roPUUZI5FI9guQceBobDfgtaj8b1dMBcSeeSsfg SGh3XunKPvHJdwzvrNyIOIgLSAVb+fKYIF8KLC6itUB3hgvDuwUr+oDHdxcYCuVhBJdt Wxi4YkAsc57uWtJbecRmo5y0wqQ9EdjCguaUKnRMT/jhLJea/K7Xkcqw8aYPqEAjNW2w lWUPUz3/jIoZRSQnGyJDMTcfU13Dchde2qSxbcRNKiyyu7WSI4nYsknqgMgq6IhMsQB3 3KVw== 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=Qcxu5Yi5E0GCd6XQ6lkwKcyCZY1kpXeqv5qAPkYPMPM=; b=IGeISki+Oezgt6QOI2n97aD3tlAFwajCiZg+NyoWY3d0gDk90StDEcqkjTQfKmuN+n zfajdbxn2GCXD+Yyjy/nZtvCNtWuUPrjiE4B7We5bHu4/y5aXwtjcd4teJO6WTCp21xj zlECJ6GhwK3BgKclo7i2lU6+mSkspGoIGGMBVNuFmEeoVUVfzfhHv34Yll9Ze2JAsn4K 5AgblRN+5nTDxdftK/mE5754QhwOYOPMYAOSPWxAbB3tfvXXi+KrXm9NTdFrPQ1P/r1q /SSgERoQxD605W5czfq2fobpuJbBK+AxCJAtAjg5reTvxqCUqPiJn7cWxoz+ttD6i/1S GCDQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=jiiBHXRX; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d24si10570647ejo.567.2020.08.10.08.35.16; Mon, 10 Aug 2020 08:35:40 -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=jiiBHXRX; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728290AbgHJPcv (ORCPT + 99 others); Mon, 10 Aug 2020 11:32:51 -0400 Received: from mail.kernel.org ([198.145.29.99]:36954 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728678AbgHJPaN (ORCPT ); Mon, 10 Aug 2020 11:30:13 -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 03B8522D74; Mon, 10 Aug 2020 15:30:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1597073413; bh=O8uxpY19oMyTmj5VGnKGFEp+hLgqpN7HCtchkQbSam4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jiiBHXRXWpzBWbFQ7OJVPm5UgI6i58IiYUAVpp3hl01zHk8BjPbRV/mL+wSYnQb5Q 4ItqS639oOzZNMjqKhAD3OTM5c+hphFKszxk8zT3Y6FiVC5uabRHdM3ZoHl1Vx32YG U7oKuV4W2jlIgcC6FpaCDPVm3gPt7NQtsiPjL0ts= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Wolfram Sang , Alain Volmat , Wolfram Sang , Sasha Levin Subject: [PATCH 4.19 23/48] i2c: slave: add sanity check when unregistering Date: Mon, 10 Aug 2020 17:21:45 +0200 Message-Id: <20200810151805.359915557@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200810151804.199494191@linuxfoundation.org> References: <20200810151804.199494191@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: Wolfram Sang [ Upstream commit 8808981baf96e1b3dea1f08461e4d958aa0dbde1 ] Signed-off-by: Wolfram Sang Reviewed-by: Alain Volmat Signed-off-by: Wolfram Sang Signed-off-by: Sasha Levin --- drivers/i2c/i2c-core-slave.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/i2c/i2c-core-slave.c b/drivers/i2c/i2c-core-slave.c index 88959c8580ce0..f2e7e373ee478 100644 --- a/drivers/i2c/i2c-core-slave.c +++ b/drivers/i2c/i2c-core-slave.c @@ -62,6 +62,9 @@ int i2c_slave_unregister(struct i2c_client *client) { int ret; + if (IS_ERR_OR_NULL(client)) + return -EINVAL; + if (!client->adapter->algo->unreg_slave) { dev_err(&client->dev, "%s: not supported by adapter\n", __func__); return -EOPNOTSUPP; -- 2.25.1