Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp2280699pxb; Tue, 12 Oct 2021 03:17:45 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyX39iOjqhCI+q4brRx/KJrCNHGXsUkeuHFSy2hWWLaZuMw6ED6qnylf/veQZ8YCO0CoWjM X-Received: by 2002:a05:6402:35c4:: with SMTP id z4mr48990538edc.197.1634033865188; Tue, 12 Oct 2021 03:17:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634033865; cv=none; d=google.com; s=arc-20160816; b=LwAXLmESgUuEdImdJOlF3lQP1iaErZP0dg8cHBOid4s5ZVvLamOFmCNHjt4IBK0W9v kLerzywlHQtyndansaiX2D58EmAWI+UAI6OhKXDgRDP3+8NGg4AYknuaJnkzQYDxyQtT JBg8I/5dL0K6yPmXDqeK/t2iCWAr+4eEKHRmsu3KGqjfCvSlvk+VN8XRkAbRTohsCygz wTJxAPdSfJ89h5Gbj9oi5v2h2Zw+PfuUVBVdves0PG5Oh8DcQUFn2v7MbuBXgoM/c2ef dGzzibUxHaqC9XYxHhqtpB7n9hs6Aj+tPl5VgDfoTUXoV5exDMkTPjsEaXqA5TgBC3lK bNSw== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=6QbSN9AwgyB7YvMXjQ9wGOfwm5L9SfWX6cJ4H4aiOcw=; b=umjro2YpOmJxMAH1/XJM3jA/ocy85Zvis362sRPezYIzm4xLDKqUEhcdsnXOWPA1VG uGjQYxCAR0R2R/L+iMW4nVO1lsVdd190F+HJ8M9iXBZZkHcNczRMXu11yG8Z0ZqbZFIR 1TgjUA+81hhOBAwkB+wFI7IMSOR11LG5daGwCgxYnyZi6VrPdypTWovSS2M1+D6gStH5 c/mZN0eHro8UsDVXqpRgkKpoRckiUh+HA0Qb1A6eqWd7YbSMj4bZneLcPpRx+O+fCkzk FQzrAneDE+PfNinN7VMgt+xrTMoiCb1o2cOPUKfGGD33BzNPjOpw0I+oaQW+KuRCe6dr EBgQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=I6JH1SD4; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id jy4si15310613ejc.149.2021.10.12.03.17.18; Tue, 12 Oct 2021 03:17:45 -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=@linaro.org header.s=google header.b=I6JH1SD4; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235774AbhJLKR2 (ORCPT + 99 others); Tue, 12 Oct 2021 06:17:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57498 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232699AbhJLKR1 (ORCPT ); Tue, 12 Oct 2021 06:17:27 -0400 Received: from mail-wr1-x42f.google.com (mail-wr1-x42f.google.com [IPv6:2a00:1450:4864:20::42f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2A6F2C061570 for ; Tue, 12 Oct 2021 03:15:26 -0700 (PDT) Received: by mail-wr1-x42f.google.com with SMTP id g25so18818228wrb.2 for ; Tue, 12 Oct 2021 03:15:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=6QbSN9AwgyB7YvMXjQ9wGOfwm5L9SfWX6cJ4H4aiOcw=; b=I6JH1SD4d+mxJgU41Ukt5Yi7cIner7iuvPmkLYnQE8EuACtOW7bFgFigqbMeJX0THw xP/cb89RpE7uokfUFL93RNjkwHW5voE0Gk4eg4LKGaRRonx4Q36UXqSiYUP8NMxXY7MS 2Ugw+A3pKYhZTrSIXOW5K1vIAjXHnjwBO96YK3wc6eG1rwb1OLs+9bzrJ48y7vHnwZQq poPwCunfY9338ddLwYQSwSNpemrUGQQglAkzc2v6DX4tDnshC1My8JvLnJkdi083o7J7 u2TLx+8LpNa/XY29A28R+V+jZPlrO/crvHVaHqu0W6VqfldPunV/fst+eNjqtNk0lp5E NIkg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=6QbSN9AwgyB7YvMXjQ9wGOfwm5L9SfWX6cJ4H4aiOcw=; b=kqozrDjiwPgtB5Og3IvcgHdt1KukeR82MW4EoX8Q9+K/vSTOz6wS59/QPF/G94NfHD Kv24WyjBsCxPJhWT6IJSVKl8aN51eb2Iwm5rfqDdn5KFR4TgSnIUcnMiPYk/MWDGMcTz wedwHHUAUgGocKhYMO0yayjEi+8dNGDlbT6pxDVKrGwEvZdyAmTW45iTPeN1xvCirRk6 GFXZ5PGhShvldVBsBIXgVSr49maiyxQhbmVGjebjrJ5ahx4bzUN3pU4mlewKoU1Hxpbv g4B1aa14ay31Eul+xUngeHLAkrts3wNvSllJGffgUYUgFrUH83Jooh1floySrAHU9OVe kz6g== X-Gm-Message-State: AOAM533nzy9vCK7RlDKN3W48G+UFa+IDUuhVxFfGjFg7oWJ3Lp7hGUIa iLpf3CuU0mlze9NuNGougyLnaw== X-Received: by 2002:adf:b748:: with SMTP id n8mr30225878wre.133.1634033724575; Tue, 12 Oct 2021 03:15:24 -0700 (PDT) Received: from srini-hackbox.lan (cpc86377-aztw32-2-0-cust226.18-1.cable.virginm.net. [92.233.226.227]) by smtp.gmail.com with ESMTPSA id t21sm2026514wmi.19.2021.10.12.03.15.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Oct 2021 03:15:24 -0700 (PDT) From: Srinivas Kandagatla To: vkoul@kernel.org Cc: yung-chuan.liao@linux.intel.com, pierre-louis.bossart@linux.intel.com, sanyog.r.kale@intel.com, guennadi.liakhovetski@linux.intel.com, rander.wang@intel.com, alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, Srinivas Kandagatla Subject: [PATCH] soundwire: bus: stop dereferencing invalid slave pointer Date: Tue, 12 Oct 2021 11:15:21 +0100 Message-Id: <20211012101521.32087-1-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.21.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Slave pointer is invalid after end of list iteration, using this would result in below Memory abort. Unable to handle kernel NULL pointer dereference at virtual address 0000000000000004 ... Call trace: __dev_printk+0x34/0x7c _dev_warn+0x6c/0x90 sdw_bus_exit_clk_stop+0x194/0x1d0 swrm_runtime_resume+0x13c/0x238 pm_generic_runtime_resume+0x2c/0x48 __rpm_callback+0x44/0x150 rpm_callback+0x6c/0x78 rpm_resume+0x314/0x558 rpm_resume+0x378/0x558 rpm_resume+0x378/0x558 __pm_runtime_resume+0x3c/0x88 Use bus->dev instead to print this error message. Fixes: b50bb8ba369cd ("soundwire: bus: handle -ENODATA errors in clock stop/start sequences") Signed-off-by: Srinivas Kandagatla --- drivers/soundwire/bus.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/soundwire/bus.c b/drivers/soundwire/bus.c index 1b115734a8f6..67369e941d0d 100644 --- a/drivers/soundwire/bus.c +++ b/drivers/soundwire/bus.c @@ -1110,7 +1110,7 @@ int sdw_bus_exit_clk_stop(struct sdw_bus *bus) if (!simple_clk_stop) { ret = sdw_bus_wait_for_clk_prep_deprep(bus, SDW_BROADCAST_DEV_NUM); if (ret < 0) - dev_warn(&slave->dev, "clock stop deprepare wait failed:%d\n", ret); + dev_warn(bus->dev, "clock stop deprepare wait failed:%d\n", ret); } list_for_each_entry(slave, &bus->slaves, node) { -- 2.21.0