Received: by 2002:a05:7412:3b8b:b0:fc:a2b0:25d7 with SMTP id nd11csp2004808rdb; Sun, 11 Feb 2024 07:11:32 -0800 (PST) X-Google-Smtp-Source: AGHT+IHUPTDOvB5eFUERbDbIi9sygZfll7wZ4mJyDxFN7vmZkDBk3dAeA2ujrSckQnl9rx6eWoXF X-Received: by 2002:ac8:5bd5:0:b0:42c:69c6:bb65 with SMTP id b21-20020ac85bd5000000b0042c69c6bb65mr5957020qtb.44.1707664292650; Sun, 11 Feb 2024 07:11:32 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707664292; cv=pass; d=google.com; s=arc-20160816; b=AxniSn87I28W9yc85RiQmjOQ64YcSptrnttlyagKstZOeYqueYLm1nT/rw7/hdKhDo +DFXYaijheZV2Vq9aRjcG6gScHgND8gaB4t6wy0db5mUn8bpR05Xj2gqwVbA9v5q6Rp7 wbXqnc83rtauTBjvprFyC0kNJdOdqKB3MeMZ13mAK6ICf2rcjUoxNBHJNpR5GD9NghPe vTsoijwIUNqNrFN6zWKTZckrRmX6rfHen8EBjt9fNS5Qhp+CMJ4QSs2aIGR0zFKAiNgh 8G/ilSkwUCS3RhzNXa7LUrB45XTM1hEZfHoRQrquxz/xfMNwk3FTUsgpLxcBFPxz3xTg HF0A== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from; bh=UQLto9M69hUu9N6gVri5jwZoeEZKMbFdJyKjTeLwQBk=; fh=iluXvIlTnm069HThp4ky7jHL0A9vAELcHmGBTkd+L40=; b=Ttl4tqA57fozGBaVTqP3uza+dhDepE4CobTz0TKuLjTVPhhEvax6ni9Htf21Adk3Xt /HVbb1398tCAA6R0ZDihACtYQdnruU4eooAJFwj2zsNldaK1j54hHP368fVBTXxSSJ4s HCRJGdy1/V23Xy37YsONPpVvgWGomTj6Pblk01vZznkD8bvBZExkexpaqAdytEgTCTDV J6LfpSj5L+MAoidhdsX4HcqPj28B7AxJjLC2Mu8H1GdIH1vAdYMNgDJTpgRaCE3JEHmE VU8O4mTOJLqBKmGd9jwlKjXYPg4Nhr4zDWVBsLOKaK+1ZtCwxM6DE+NcQzmCwJeIj3fy PiLw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=aladdin.ru dmarc=pass fromdomain=aladdin.ru); spf=pass (google.com: domain of linux-kernel+bounces-60826-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-60826-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=aladdin.ru X-Forwarded-Encrypted: i=2; AJvYcCVwIqLbTIZODgx4xLS/wuO00kVMB2ZZyK91tbLtHhI4EUv/qRebk+RwZZtBlvyaks+aeZBI8zHSlMMzSFifN7Q9QohqbJUSgkmt64vD8A== Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id 7-20020ac85707000000b0042c42bd45a5si6547614qtw.777.2024.02.11.07.11.32 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 11 Feb 2024 07:11:32 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-60826-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=aladdin.ru dmarc=pass fromdomain=aladdin.ru); spf=pass (google.com: domain of linux-kernel+bounces-60826-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-60826-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=aladdin.ru 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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 6C6071C20ED7 for ; Sun, 11 Feb 2024 15:11:32 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B51415D477; Sun, 11 Feb 2024 15:09:47 +0000 (UTC) Received: from mail-out.aladdin-rd.ru (mail-out.aladdin-rd.ru [91.199.251.16]) (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 AA4F75D46D for ; Sun, 11 Feb 2024 15:09:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.199.251.16 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707664187; cv=none; b=lhIjVEVh+ZGBWof9WadLZu7v7AqN6AYxW+v9t963EMQmdgFP0nWAxZKjjJlI3kbowygHGBc60HAFSIPbQtBiUbkTV8Y2b2RQZsOYu/o8EgjSyneE3XTqIF8JD7BPmnjXah2HEFyCCqbpxdQof8K5lJqsr7MNM7QkkMdLLhLfp3E= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707664187; c=relaxed/simple; bh=oM+ZoyIjXDNRxwrDc/pX5Se6omq6E/r+S5nA28fWjWk=; h=From:To:CC:Subject:Date:Message-ID:MIME-Version:Content-Type; b=Goon192eMW4T7kuPCZ3nlBOSiTXo/aWqbOx2JsGqooB9KWe04DYiX+u8wBXfcCrRYZfbmLbGeECkwi0xN8M3fLEP8I3wJyhBNg/Bq/QYA09DXT4NIyBb4e646QVZkjvlpmOV/4XtUSBY2Vkqn007qBH+LmprJ0iqCZj+ozlP02Y= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=aladdin.ru; spf=pass smtp.mailfrom=aladdin.ru; arc=none smtp.client-ip=91.199.251.16 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=aladdin.ru Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=aladdin.ru From: Daniil Dulov To: Vinod Koul CC: Daniil Dulov , Bard Liao , Pierre-Louis Bossart , Sanyog Kale , , , Subject: [PATCH] soundwire: fix double free of pointer Date: Sun, 11 Feb 2024 07:09:37 -0800 Message-ID: <20240211150937.4058-1-d.dulov@aladdin.ru> X-Mailer: git-send-email 2.25.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: EXCH-2016-04.aladdin.ru (192.168.1.104) To EXCH-2016-01.aladdin.ru (192.168.1.101) If sdw_ml_sync_bank_switch() returns error not on the first iteration, it leads to freeing prevously freed memory. So, set the pointer to NULL after each successful bank switch. Signed-off-by: Daniil Dulov --- drivers/soundwire/stream.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/soundwire/stream.c b/drivers/soundwire/stream.c index 304ff2ee7d75..d650e6f0f8e7 100644 --- a/drivers/soundwire/stream.c +++ b/drivers/soundwire/stream.c @@ -833,6 +833,7 @@ static int do_bank_switch(struct sdw_stream_runtime *stream) "multi link bank switch failed: %d\n", ret); goto error; } + bus->defer_msg.msg = NULL; if (multi_link) mutex_unlock(&bus->msg_lock); -- 2.25.1