Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp3436565imw; Thu, 7 Jul 2022 01:32:17 -0700 (PDT) X-Google-Smtp-Source: AGRyM1snenhsaZolJ7/7L2bZHsE6F7Bx9GYO+oSkzlyIg39E/q0tDxxfh+7VDyfKMfcId64RrZow X-Received: by 2002:a17:90b:e02:b0:1ef:71e5:a18a with SMTP id ge2-20020a17090b0e0200b001ef71e5a18amr3674851pjb.177.1657182736851; Thu, 07 Jul 2022 01:32:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657182736; cv=none; d=google.com; s=arc-20160816; b=IG9x0i1RFpHH5YUUToWte8lxzvm8UblYXPqOkSFcV5CWUX2mNsii1edqB5RMFYcRSc pkoS8kWOwTQcPMKhgzdmVB3XP9vBfIyi0z5jQmqrLP6v8nLor4Kz2eZwdG1JNdEASAXq mn4YarCoaAUsKFC1Xy6lnUFu8ZhIN9ctXjXKxrDQ4ZEk0d2SApehnZpwj4xhnCpGgDJ7 XgLLIlwv6V8vSXaaB75mcOq+HJBN9jrBVDbikRSSWavmSvsJzrf+Qpns9z79jLbr1LgV 2/mw1tPkoGIYT8qFDlxZ6renwHYTbsZUnyTP8p8BTJHw+RZh4OOyQJmJCu+BS867jhBd xjpQ== 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=7AgIPqLatZhsIY/aKdspec70zCa/ClqK3dmXj4f62X4=; b=wY5OfpyB89XxKKLK2ulmPcUjpxOnd1XwyI84x1vxSvTInmud4/HZj3MsjgXprFjkvc ksm3nhdqHGxOfOHk1DR4NeDCWc9G2AVkX8v5ZClTjjD8ZNwb7XiRtDSyqHOouWkytyyp 8SjtHiNOYQz/he+8EmPupmchE9V30x4cmP7L+W65t/t1aEwboaTq/5dqVH64F9N8JnTh 5PYRmFnHnNoI6JMPSHC8Xq1lxenBMT6buFLYRlYWVv+PHLp4AgY69HzQ/K7jjKE7DBQR AJlAa02nTgwmHGnmscmvi/1ijimuJWeZP7shZvU514RIhnWUZwDRR9TFG1cF9vMdpDdj PWjw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=cSC6w3SP; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r14-20020a17090b050e00b001ef8a680761si12158815pjz.34.2022.07.07.01.32.03; Thu, 07 Jul 2022 01:32:16 -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=@gmail.com header.s=20210112 header.b=cSC6w3SP; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235221AbiGGIIF (ORCPT + 99 others); Thu, 7 Jul 2022 04:08:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53620 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233608AbiGGIID (ORCPT ); Thu, 7 Jul 2022 04:08:03 -0400 Received: from mail-pf1-x42c.google.com (mail-pf1-x42c.google.com [IPv6:2607:f8b0:4864:20::42c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 08D1233E27 for ; Thu, 7 Jul 2022 01:08:02 -0700 (PDT) Received: by mail-pf1-x42c.google.com with SMTP id j3so5212639pfb.6 for ; Thu, 07 Jul 2022 01:08:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=7AgIPqLatZhsIY/aKdspec70zCa/ClqK3dmXj4f62X4=; b=cSC6w3SPfVcJl9Mn7LEYDhIoOCCmZ1dIs9O6cwmm0gOvS2Z3JZkmV8VhSt09Xcwgqc WZPegT46+l8pbrcGz19c27Qw6clAXXkdcjI6d6Jz7XSOJqglRATC9/04s5TZvDYjlVqs 8NXhKeIcTtMx2ZjgFCxwUM6nAnQTqgm1mAZ/HBaIe8y0CqVlRz5ejaphlPg/dblLkGSF xgbYrWVbLRkMpgHILhUbY0lCOEHAY5Ko0lqT0rc1H5HjRKXJwwBIYUBUKROBEj9q3HU/ ZvicMJTxQj23shJ752g3CnrNnml/n8Gj7a/xpCkAov9o+Cut4s/KafnazwpvmZw/PJxn bHgw== 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=7AgIPqLatZhsIY/aKdspec70zCa/ClqK3dmXj4f62X4=; b=EO7DvTEWVk2cdXhgS5Ns0SfnZdXlq+GqVIOMmob5iTfeBOE+kBib4T/n4c1Tpi7Cso wgZHkM03/7/NTokjkJlyHbnkQokXVDD4iSkuTSUBWxZm8D8t8OBB3Gkdwpobl6y4xY9s GdRkFrRNyGMlujuFAQ7Pz0VVM5XgSi/9OkFznDcAVNnYl1+U6os/gTlXXRAenTHL42eu Gq4AabAjIKaFy0D9eRMCztT7GlDHCqGhDT0YrCLwpxZt6ZyXByTGMBesos8iPEahhFQd 3zCn3nO4T7Eb9L3bMik9D0XBaypBE01msQpTQOqfjKuNgi3qPk4Yg2+BdNyZVhEBliDz zhUQ== X-Gm-Message-State: AJIora+kEB4z5skEiEQGGIF/Z91vqU5gWcfxSht8nvoznB0mOI2wiI4X 2210XBjNRLyqbYzb7za6c/k1C3R9vmOMQg== X-Received: by 2002:a17:902:e5d1:b0:16b:ece4:79e6 with SMTP id u17-20020a170902e5d100b0016bece479e6mr17118256plf.83.1657181281582; Thu, 07 Jul 2022 01:08:01 -0700 (PDT) Received: from octofox.hsd1.ca.comcast.net ([2601:641:401:1d20:a3e3:ea8c:2267:a237]) by smtp.gmail.com with ESMTPSA id p4-20020a170902e74400b0016c0c82e85csm1377374plf.75.2022.07.07.01.08.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Jul 2022 01:08:01 -0700 (PDT) From: Max Filippov To: linux-xtensa@linux-xtensa.org Cc: Chris Zankel , linux-kernel@vger.kernel.org, Yang Yingliang , Max Filippov Subject: [PATCH 0/3] xtensa: iss/network initialization error path fixes Date: Thu, 7 Jul 2022 01:07:58 -0700 Message-Id: <20220707080801.3496148-1-jcmvbkbc@gmail.com> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=0.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, FROM_LOCAL_NOVOWEL,HK_RANDOM_ENVFROM,HK_RANDOM_FROM,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=no 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 Hello, this series cleans up xtensa ISS network driver and fixes memory leaks in initialization error paths. The series was prompted by the patch [1] from Yang Yingliang, but that patch alone has issues: - a newly created net_device was added to a list of devices and not removed from it in case of error leading to UAF. The way the device list was used in the driver doesn't make much sense, so patch 1 removes it altogether. - a call to platform_device_unregister would complain that iss-netdev does not have a release() function and must be fixed. Patch 2 adds the release function for the iss-netdev platform device. - a proper release() function for the platform device must free the net_device object, so the error path that calls platform_device_unregister must not call free_netdev afterwards to avoid double free. I've modified the patch 3 so that it does that and updated the description. [1] https://lore.kernel.org/lkml/20220707023229.2580893-1-yangyingliang@huawei.com/ Max Filippov (2): xtensa: iss/network: drop 'devices' list xtensa: iss/network: provide release() callback Yang Yingliang (1): xtensa: iss: fix handling error cases in iss_net_configure() arch/xtensa/platforms/iss/network.c | 63 +++++++++++++---------------- 1 file changed, 28 insertions(+), 35 deletions(-) -- 2.30.2