Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp607962rwr; Thu, 20 Apr 2023 04:09:22 -0700 (PDT) X-Google-Smtp-Source: AKy350beSGa61yAevlnX8HtXjMXHR3mCs6dfEXtxRLpzTksIMjk51cZPEyoKbl2vuisMT2/x2JwY X-Received: by 2002:a05:6a21:798:b0:f1:8f7:eeb6 with SMTP id mg24-20020a056a21079800b000f108f7eeb6mr1356924pzb.59.1681988962658; Thu, 20 Apr 2023 04:09:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681988962; cv=none; d=google.com; s=arc-20160816; b=DsKs5ezGPArtloKVd7vZ8kpoDim7FoC5KwrkRYlCVbyu8zwIY2s9NF3+QUgQKYVda3 5G3jb5INZqGBwwImhxaGI4a1Qzs6XoQBdBXWts4tKUZSTn77E3Ja/iEAGWm92EgMoNth nypzKp2kbgDRtjH8G25vU6agkvpW2P7sbHzGBz+zxFTsk+v97Ta819p3lHTj/YSE+QHq +z0q6DfpDLJSLYZqFFQys/v2DVFfBkJ1BO12KKq4eBP5pvEmJH8mjFpHtULQ/CBex4GI 4DqAWVtd2W23rnb4vqeitY2q5QM8SsbpB+AFGzBEBc6ZrAr6GtqIQIGa85WSvdHruiHv v+BQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=DNV9pdlMIj47evcHh4/CIFnEgVM0UOHpspJEGa3or8Q=; b=rjaI6Axcl0+UPAtUk4maxE0mPMVg8oArlfGKhtDTo41JG3rKSmy4qVeB6UCE195nNd fkAHEhrrGx+a4w8pZgHEq4pYMXZEFXgJKlfsZEmaWPZej/z2sYxBs5AdPV/8eG3q9sIi 5p22wWKp2o69xRSS2YpCzoVHOZ4IyUv1fWm/eo1DpaYOsLpRqY7scKE9/LlbvoKJBdKu VMogud7MiF8nnbr3IXf6mlXc6ylHDIX7V2z8r7fsIQpAXU9cKv0mvya9TLXjfutPwx4n UmMjNeWGGXN7AqKaK+j9q7aQWFMxyAWMKNOjQO7B8rJTFU4YTJLon5dqVNTTGE2gHRe+ XePQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=BPkd7qxc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v63-20020a638942000000b0050f83a9e61fsi1480561pgd.278.2023.04.20.04.09.02; Thu, 20 Apr 2023 04:09:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=BPkd7qxc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S235132AbjDTLII (ORCPT + 99 others); Thu, 20 Apr 2023 07:08:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54448 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234611AbjDTLFi (ORCPT ); Thu, 20 Apr 2023 07:05:38 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E7E4283F5; Thu, 20 Apr 2023 04:04:05 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 1E5D9647CD; Thu, 20 Apr 2023 11:03:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D3B58C433EF; Thu, 20 Apr 2023 11:03:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1681988612; bh=NZrnd8QS9D7YxLacsJYmOPmK2ytxRfYPCgRmL+pnBik=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BPkd7qxcY/+BMgd3Myt8m284Agj0tSZJ33KrcZ6CCL4xCKNlDvfHPZMGqSrkN/jpO o0nD9I8f/FB6ANIltnIJUDynKRbQZXsviRlU/PRY1/UfGO6JLl/oBq/k/xrzua+PKK uxsjK7Lb77JPyPwzFDIYOaGA9TaxdJtwGKuM+TMBC+ja9fWMCWdA7cM6aps5OXH6aX tWL6fXL4hHro+x249UAjJTE+Aq3+ozxZYmQlPpc6c2sRXZaH1VaInDvKWm2IiCRmAP jraN8bEIakaeLDltFIxuGv5T3nhZVUYDvcXOzik57g5FbEm3OvT7iTdmOxAyBdF8xZ KgXCD6b9jBD8Q== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: =?UTF-8?q?Patrik=20Dahlstr=C3=B6m?= , Jonathan Cameron , Sasha Levin , jic23@kernel.org, linux-iio@vger.kernel.org Subject: [PATCH AUTOSEL 5.10 2/3] iio: adc: palmas_gpadc: fix NULL dereference on rmmod Date: Thu, 20 Apr 2023 07:03:23 -0400 Message-Id: <20230420110326.506279-2-sashal@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230420110326.506279-1-sashal@kernel.org> References: <20230420110326.506279-1-sashal@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Patrik Dahlström [ Upstream commit 49f76c499d38bf67803438eee88c8300d0f6ce09 ] Calling dev_to_iio_dev() on a platform device pointer is undefined and will make adc NULL. Signed-off-by: Patrik Dahlström Link: https://lore.kernel.org/r/20230313205029.1881745-1-risca@dalakolonin.se Signed-off-by: Jonathan Cameron Signed-off-by: Sasha Levin --- drivers/iio/adc/palmas_gpadc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/iio/adc/palmas_gpadc.c b/drivers/iio/adc/palmas_gpadc.c index f4756671cddb6..6ed0d151ad21a 100644 --- a/drivers/iio/adc/palmas_gpadc.c +++ b/drivers/iio/adc/palmas_gpadc.c @@ -628,7 +628,7 @@ static int palmas_gpadc_probe(struct platform_device *pdev) static int palmas_gpadc_remove(struct platform_device *pdev) { - struct iio_dev *indio_dev = dev_to_iio_dev(&pdev->dev); + struct iio_dev *indio_dev = dev_get_drvdata(&pdev->dev); struct palmas_gpadc *adc = iio_priv(indio_dev); if (adc->wakeup1_enable || adc->wakeup2_enable) -- 2.39.2