Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp4419317pxa; Mon, 10 Aug 2020 08:39:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyRSYnDdFiaZlSheA9z05ZdQX6wseE5pUYPBGwQjDMufZTYvzWmiVHp7JedL/Ynp9vvGOrU X-Received: by 2002:aa7:dbd9:: with SMTP id v25mr22258925edt.137.1597073945605; Mon, 10 Aug 2020 08:39:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597073945; cv=none; d=google.com; s=arc-20160816; b=UL0FHeWnXw8Ttc1VyWrXJz+qbxd4b2qKEIr1e+6hgRd/Az8LAnseEdHH9x9o0LsxOC LMz0gXIBKERzvHyXmlS785t2vWkvKmlnAdL4rQcljicB4RGAKmNrkaq53xf4Zi14IBGb wh8AeS1yiwjHm66Q0rwBFISDzZHNvitvjPBWVRUAeZg8Wgpgh56eZp5Jel2QKCIoFojf Uh5F4Mhdt+FKrTHt57TWLaRw65vGeMn42jN/a1rm+89PgdcXsSH5jhxwubvbMksABlhi Hey1bWbtv5VMMzuUpr2F9GgTT/MNGhzMy0P/ypd2nLia00aFA2NImH33zzQgqWN0Vw1g 99BQ== 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=cAn4DZMMgh66Q9s4joq8s2PYkzqmn8RNaGQkWr+zW30=; b=gsOal28Qzl/jAmsaVNCOVBpZwjjGwfEn6omMXobRfxk2ya/bjQ1U3grRsd52rXsbef T7I4BZtt9VuQXmTkSxkkaUEno7dIn4iIU1BW8xmWEJ7splR3TsTD/eiS5glyczeCgaor AgGSv/VAV0nC5zbNsFRKcALvFWLTHtEVXhDVIBIjN3Kf3qGXpQysB7Zj4MnlK5BpwD5Y 9zyRUz/8i5inD6x8lWn3lH3qDM022USClj2/+jlSriqdfHyd2iZL75bu0h+aXv5Enk6q ODeU7w3U59ryXUns2oxjb3r3BrtlYRGx9PR+LtzQzpLQr0ibOsFxO7k1aR+iUlmUZKVt y8nA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=iJ3NFIqZ; 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 ci17si10502190ejb.743.2020.08.10.08.38.42; Mon, 10 Aug 2020 08:39:05 -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=iJ3NFIqZ; 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 S1729001AbgHJPgQ (ORCPT + 99 others); Mon, 10 Aug 2020 11:36:16 -0400 Received: from mail.kernel.org ([198.145.29.99]:33290 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728745AbgHJP1Y (ORCPT ); Mon, 10 Aug 2020 11:27:24 -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 4612222CF7; Mon, 10 Aug 2020 15:27:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1597073243; bh=gQWng/bO5oR+BA08SNco2VcnZgToS77LbevgmS+C7z4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iJ3NFIqZlN9oNRRv4uQj2NqS0Pi2hF5USVikDk2Yk4yL9BzRsCZ2uhaMG8fDIbl5t UVuBTLHsdhmFEY6Af62rcRwa4ovY8m6b7lud84qJhdQntR87GeIcZM1ZCLkizvOCCz LRxSn5HSVwIeO+tpArPDSaE1Smrx0fBs+PnRKNAU= 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 5.4 37/67] i2c: slave: add sanity check when unregistering Date: Mon, 10 Aug 2020 17:21:24 +0200 Message-Id: <20200810151811.269933247@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200810151809.438685785@linuxfoundation.org> References: <20200810151809.438685785@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 549751347e6c7..1589179d5eb92 100644 --- a/drivers/i2c/i2c-core-slave.c +++ b/drivers/i2c/i2c-core-slave.c @@ -58,6 +58,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