From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wr1-f50.google.com (mail-wr1-f50.google.com [209.85.221.50]) (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 12F9E23D2A1 for ; Fri, 22 May 2026 23:01:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.50 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779490902; cv=none; b=noBvrnOrOjrfWedWbm5Ypn/So8SlAPlpDOlZU+j01rJE50hQhGDoRnNaga4xnrhkzyRK0mM2ragiltBwpkj5zRR7SrFEXGyPizqMuGpaPSVPBUPyd39PribgYLhvgqlRq4Aa7bRdzob3O639eB+M1sT0+WdxjVXHgYpbKSZ0TXw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779490902; c=relaxed/simple; bh=iuMEjfjDUMd4AbOPk1EOV0XIzooLS+4evH0xt/olMQc=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=MAqS5I9D5sWBH0cIXQELP11LEPfxFW+98YxwTIKJShRMt5GrWlAsSpEIEtRRJa9YQhXungotybl8JjjOwObdLsGvI8YJYDpSh6kUAqBTPmZDsFwkoIQR7HslSkphnFNNjEjS+FGA6szDR/E3YEJOhSi4Vs40DjYj7y0dYIuHP9I= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=EGW338Sj; arc=none smtp.client-ip=209.85.221.50 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="EGW338Sj" Received: by mail-wr1-f50.google.com with SMTP id ffacd0b85a97d-44b729aa7c5so839677f8f.2 for ; Fri, 22 May 2026 16:01:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1779490899; x=1780095699; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=WZ1t8TITeIzqYfvXIOImRBm/6eBqY77bSs40Iip+zDk=; b=EGW338Sj7P67oPHs2bKOzoi5qrv1pIRYkk2lvPXtqmC4QPOi/3bfsJM45jFjAU6r6X 8imfR7kX4yG5WB1VXb9lYEtIMaOsa6dF4V72KybD0C4wq0C1nzKMD6SVRbdeBc59AKFN L3886Xunw30i0GJs7KTS3S8ITHjMHU5Qf3ymgAbj+w/YmkUQzYgOmHLYrIzoGvGilnxY jTNBXL+zIseJ5Yzc+Q3LOU7fi6rkCZInfBK0Xh+M7PeNm7NmMTZxudN5i2v/bvO86rxh Wfpx2gQ26JrhBcjrRLXER2nGg84lxBr+xpMGV9snizTGNJzVRW+DKbuK6mvzkT/Xi5kj saow== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1779490899; x=1780095699; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=WZ1t8TITeIzqYfvXIOImRBm/6eBqY77bSs40Iip+zDk=; b=Al7W+WLuFXlRN1myCglqibl7NyqE9jAPKFjPdMFgQUVqYl9brtBZEXK2SqwvQpU+Cg B7AS6u/wJvE08cvsuIy733DMu8P7hZIG2jNeBJCCopROH7u2eVE6W9nquhnLilJNS1ei UwG+5uNl/kpDMWGn3rIYC63K6XN6BUWcd7O0a75R2V/skZTKYcGHMCqaw6ZrG7xHNPec ArJF6UEMfL1XVWetNZ+rHk7DI0HoR4NFkn95Xs/Car90bySjK3lmEXlloy+WIsC3OqgD fVaWfq5GjoqKoWbfi4tfZsWuXUuHh3D4AsyqmFiev7CDBGsNeOeHxtvCYsZTxIesDVss VfDw== X-Forwarded-Encrypted: i=1; AFNElJ9v9clTNNGB+fllgoIxC4C/xLHY4/lYVmYtIsnSkFBapyV5yGYOU4bgMcfaSbSKJ9o5rnL0egGNWZa0N20=@vger.kernel.org X-Gm-Message-State: AOJu0YymUJzjSxSKq2PbNxzRQ44mmLhr+mX4HGmDTIdYEJT0j5olDyH+ bDViLrXzcoydZyIDU+Fy7dG2Jx9iOvmjE53wkvwkvBFPa2J9DWNDxMiS X-Gm-Gg: Acq92OGYxHB7dBJCMVnf/FO393rwDtR/ft8riTlTygi4Qp3ywipGjBOWC/PHQ0+tSYr yCoYuj1ziyxbP6UeTCJzOkY5xqtmq2dMYpdlWF5R0S6iGIIC7m2YoLMk+eLCm2kxPC09NYkhQew Wf98kX2r4QHEuU7+2INcHoJLBLtZpE3nrLL9THtjybJVcBnN0RKQDQLPWq8h03edzjIRA5llwBs oSzzpvWdkTZywLZvGJBZ0vfo6fpU+v1q5WfjxlN/KRxBHa+F6Js+xq/sVySAo9xEW8DoDWq9KS3 rspE6YvkKd2X7Q+onckiPZftXGZeD55gs/AhUewCEpJdd2vSZZnnUh8GVjeSqNX5/Y/s/K6x9q2 zOeMOPnRVe3zTwnVf4ixf8fTe0uM3TCBdP+HZ22Rnh/FacJrFM+EA9ILClMJhM72sEgX2TaQfcU /jIwTk3lvz+5KBaxCtjrZ/YDFR7/0WOSz44AqWxHUrQKRfo6CGRGz2nkPSxaQgM9vzBecG/fMVP g== X-Received: by 2002:a05:600c:474d:b0:490:3d89:4bd1 with SMTP id 5b1f17b1804b1-49042ae9a03mr34525745e9.5.1779490899184; Fri, 22 May 2026 16:01:39 -0700 (PDT) Received: from menon.v.cablecom.net (84-74-0-139.dclient.hispeed.ch. [84.74.0.139]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-490456274ebsm67100265e9.15.2026.05.22.16.01.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 May 2026 16:01:38 -0700 (PDT) From: Lothar Rubusch To: thorsten.blum@linux.dev, herbert@gondor.apana.org.au, davem@davemloft.net, nicolas.ferre@microchip.com, alexandre.belloni@bootlin.com, claudiu.beznea@tuxon.dev, tudor.ambarus@linaro.org, ardb@kernel.org, linusw@kernel.org, krzk+dt@kernel.org Cc: linux-crypto@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, l.rubusch@gmail.com Subject: [PATCH v4 00/12] crypto: atmel - introduce shared i2c core client management and capability-based selection framework Date: Fri, 22 May 2026 23:01:22 +0000 Message-Id: <20260522230134.32414-1-l.rubusch@gmail.com> X-Mailer: git-send-email 2.39.5 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit This patch series introduces a staged refactoring of the Atmel crypto I2C drivers in preparation for a shared core-based architecture. The goal is to consolidate I2C client management and selection logic into a common atmel-i2c core driver while keeping ECC (ECDH) and SHA204A client drivers functionally separate but interoperating through shared infrastructure. The series moves existing ECC-specific client tracking into a shared management structure, relocates allocation and selection logic, and introduces capability-based filtering for hardware selection. This allows individual crypto drivers to request hardware clients based on supported features while still benefiting from a unified least-loaded selection strategy. Subsequent patches extend this base by: - migrating client management fully into the core driver, - introducing explicit capability advertisement by each hardware client, - updating ECC and SHA204A drivers to participate in capability-aware allocation, - and cleaning up probe/remove paths to ensure consistent lifecycle handling. No functional behavioral changes are intended at this stage beyond internal refactoring and preparation for future feature expansion. The series is designed to preserve existing crypto functionality while gradually centralizing shared logic in the atmel-i2c core layer, reducing duplication and improving maintainability across all Atmel crypto drivers. Note, this series is a more elaborated part of a bigger refactoring, sketched out here: https://sashiko.dev/#/patchset/20260512224349.64621-1-l.rubusch%40gmail.com Signed-off-by: Lothar Rubusch --- v3 -> v4: - sashiko feedback[3] - fixes and patches reordered - fix: cover a possible memory leak at deregistration and subsequent reregistration [3] https://sashiko.dev/#/patchset/20260520155703.23018-1-l.rubusch%40gmail.com v2 -> v3: - sashiko feedback[2] - ecc: reorder setting ready flag in probe() - i2c: unconditionally call flush in unregister client function, to avoid UAF for multiple devices - i2c: fixed a sleep-in-atomic bug by moving atmel_i2c_flush_queue() outside the spin_lock section - sha204a: reorder calls in remove() avoid UAF flagged risk - sha204a: rephrase commit messages [2] https://sashiko.dev/#/patchset/20260519204803.17034-1-l.rubusch%40gmail.com v1 -> v2: - going over Sashiko feedback[1] - rephrasing commit messages and titles - fix: introduce a ready/state flag to address the UAF risk - fix: add kpp lock and refcnt to impede overwriting global driver struct - fix: explicitely clearing rng cached buffer in return branch - unregistering ready state by dedicated function - reorder Atmel ECC related things and atmel I2C at beginning - reorder Atmel SHA204a related things behind introduction of cap - patches dropped: NULL checks in remove functions - changed to EXPORT_SYMBOL_GPL - additionally to alloc hw client also migrate freeing it to core driver [1] https://sashiko.dev/#/patchset/20260517180639.9657-1-l.rubusch%40gmail.com --- Lothar Rubusch (12): crypto: atmel-ecc - fix use after free situation crypto: atmel-ecc - fix multi-device kpp registration crypto: atmel-sha204a - fix heap info leak on I2C transfer failure crypto: atmel-ecc - rename driver_data before moving it into atmel-i2c crypto: atmel - rename atmel_ecc_driver_data to atmel_i2c_client_mgmt crypto: atmel-i2c - move client management instance into core crypto: atmel-i2c - introduce shared teardown helpers and fix queue flush crypto: atmel-ecc - switch to module_i2c_driver crypto: atmel-i2c - move shared client allocation logic to core crypto: atmel-i2c - implement capability-based client selection crypto: atmel-sha204a - integrate into core management tracking crypto: atmel-sha204a - switch to module_i2c_driver drivers/crypto/atmel-ecc.c | 177 ++++++++++++++++----------------- drivers/crypto/atmel-i2c.c | 77 ++++++++++++++ drivers/crypto/atmel-i2c.h | 18 +++- drivers/crypto/atmel-sha204a.c | 48 +++++---- 4 files changed, 210 insertions(+), 110 deletions(-) base-commit: 49e05bb00f2e8168695f7af4d694c39e1423e8a2 -- 2.39.5