From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=40.107.201.70 ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1796135979; b=jL6sFNUUNnrPnolx7BBs1pl/e+sHCWk/nCuI+qVjl0Q4rZBw8YXMIfmI+pb01aakUgl0 fPYY6XAuB2aXABlc6kSaUPQs18kmdkTmFAPnigzrMhtdt/wJJ+/8dlD9XP3B7/E1rhGKU 55O2hhVTS4PzgWDNJxTJ769+92YuzUQt7Ap+nnmcBBW0Rc0fxPpfYYZNyYNPjs+I0FpP/ tC3C2OF1qiiuGkZQz9OKq7iSDAwuM9GlpnDbH0UWmWbJWALnmXTGvuNm3JUKBfhGgWMdm KNz5CLzR3mgBslvMbFYB8pIjltScvv+jzbfhqurTepzn8ZYqpqkvOQ1lTjkZY1JAF0A== ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796135979; h=DMARC-Filter:DKIM-Signature:Received:Received:Message-ID:Date: User-Agent:Subject:To:Cc:References:Content-Language:From:In-Reply-To: Content-Type:Content-Transfer-Encoding:X-ClientProxiedBy:MIME-Version: X-MS-PublicTrafficType:X-MS-TrafficTypeDiagnostic: X-MS-Office365-Filtering-Correlation-Id:X-MS-Exchange-SenderADCheck: X-MS-Exchange-AntiSpam-Relay:X-Microsoft-Antispam: X-Microsoft-Antispam-Message-Info:X-Forefront-Antispam-Report: X-MS-Exchange-AntiSpam-MessageData-ChunkCount: X-MS-Exchange-AntiSpam-MessageData-0:X-OriginatorOrg: X-MS-Exchange-CrossTenant-Network-Message-Id: X-MS-Exchange-CrossTenant-AuthSource:X-MS-Exchange-CrossTenant-AuthAs: X-MS-Exchange-CrossTenant-OriginalArrivalTime: X-MS-Exchange-CrossTenant-FromEntityHeader: X-MS-Exchange-CrossTenant-Id:X-MS-Exchange-CrossTenant-MailboxType: X-MS-Exchange-CrossTenant-UserPrincipalName: X-MS-Exchange-Transport-CrossTenantHeadersStamped; bh=KRVI1/xGUM2y6cb/hd+KoOl4D9N/vG+LO020ZHYekqs=; b=kGdNLM3fIeaZC5cIXSh4mjxW0sGP2dzpg+5BVuAk63fKd8N8UohFQgK0/RRINbaZ39pJ OP7FPcyl9iK+PMz3sOMrhdy8GasX7OTfAsuiJblPM1Vix7FWo1ofW4zKlPoFI2dnapWUY fJTktKJdkId4jNFcqoylXsy6xymeG+AKyi1JkQqJ0hgrcfKDE/S8zXSsbNrQM6mKMW7ZR YnjnlvZ2c+EgtIOr/AB0bEcP22BsGrMXnYlzFUSBpz46TMXdFvmIrM/mlq6qjjzte9+ca HL+5kqZOolAy/7C8/Gz1uB0qSXLtt7jBboUn/OtPe7u/wAhKnPTOrIvD2RJZzIJ5lew== ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass header.from=nvidia.com; spf=fail smtp.mailfrom=nvidia.com; dkim=pass header.d=Nvidia.com header.i=@Nvidia.com header.a=rsa-sha256 header.s=selector2 header.b=cUMNE8rf; arc=pass header.oldest-pass=0 smtp.remote-ip=40.107.201.70 Received: from CH4PR04CU002.outbound.protection.outlook.com (mail-northcentralusazon11013070.outbound.protection.outlook.com [40.107.201.70]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (secp384r1) server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D03C9606A320 for ; Tue, 1 Dec 2026 14:39:36 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org D03C9606A320 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=nvidia.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=Nvidia.com header.i=@Nvidia.com header.a=rsa-sha256 header.s=selector2 header.b=cUMNE8rf ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=g3NkVBujWQjWp9L0zEZzUfYkuio5rzCjEWvh/SkuL17bEz9RNuanE0wcAmfYuMLXH9Zu4sOyUhVimZLV3Qp9vgNHG9R7IVXmPaJSm3zIQ0sDA9PGy2ikPi34GCOLDBFb7PR/es4GGdXqMlMJ+0H/PZd6MA601FgrOXZ3eIGAsAEyqI/4Tx1QrVfmiL0LCk/CWBeUhIrQ4Hdg3jpNtGaAYlXR0QI1L09C1hShYyUW7Ie/alvKBsX9AWWeIYekE6/vur4f68P1MseIUt+EVoW08yE52eLO4ElKkF1j5wM+Ie4LvdDRDVJJ1zwOZaM0QXBbf6o/eneQcSO8XHEr3CEq+w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=KRVI1/xGUM2y6cb/hd+KoOl4D9N/vG+LO020ZHYekqs=; b=J/k8rq8dnMn0XXwKOZexLpSfUix5xSSvq6+AQs8kGx53RvVrwOqSiu1k0YJAbgB0ukot88+pJj+PLTRgtyw61Re0PUkI98TNn7K67xzUJgAsXSoY48AlTidaSotY78eNEugYs4MeRrus/eVobxBKdUEyLCdKE8T6DuACYFzQc1uKujrQ+XgWQ5LsTt9ysrfy9Q3QB03E5HYLkFNS/PQeR4xDvbH+kQflVIkRgNK8GpSsRajQEfwxdR7xNttg65Ix38jL0YnajjATwO8jfTJ4P3cJFyozxTHbk7X6JfSYxfFSArlU9zNqbNY7PIlDVqVDZKflDOe6oW95hMK5p5gmJg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=KRVI1/xGUM2y6cb/hd+KoOl4D9N/vG+LO020ZHYekqs=; b=cUMNE8rfNA4X4evcnylp1T1nNE4f7myuZZ5LkvVpWoGNM1cS0ZQ37zR1wTaZhSMkVy2kxpkQQ8t9KQNPzGUZDzTeCMtWo7F/SA9khuKJaFl+aXAqbcBQnKX//TuDyX9m3nReGAhGG9gqOsVfe+FTd+iJ9s/TG8yaj8XrXpnctb8EEKrRF2x/abS0zv8AkVsEQ/r8weLL9s4xwcV7lQz/j1vr5inwuI8K3z9NE1i1oNJ8Rdy3lG/8XzLVQqCnvfjoEekoC1cxqFmP37UNy64fTG9yfJH00bmnLz1/Fc6E6TMrqLcA8ZJOskxJp+bAr5rw5i4iG3GLJAGJYPHkCmBvxA== Authentication-Results: mx.microsoft.com 1; dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; Received: from BL0PR12MB5505.namprd12.prod.outlook.com (2603:10b6:208:1ce::7) by CY3PR12MB9704.namprd12.prod.outlook.com (2603:10b6:930:102::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.662.12; Tue, 1 Dec 2026 14:39:27 +0000 Received: from BL0PR12MB5505.namprd12.prod.outlook.com ([fe80::9329:96cf:507a:eb21]) by BL0PR12MB5505.namprd12.prod.outlook.com ([fe80::9329:96cf:507a:eb21%5]) with mapi id 15.21.0688.009; Tue, 1 Dec 2026 14:39:27 +0000 Message-ID: <50c8d6f9-5ea0-4951-bb73-16a25d0446ab@nvidia.com> Date: Tue, 1 Dec 2026 16:39:21 +0200 User-Agent: Mozilla Thunderbird Subject: Re: [net-next,v23,06/14] virtio_net: Query and set flow filter caps To: netdev-bot+sashiko@kernel.org Cc: netdev@vger.kernel.org, mst@redhat.com, jasowang@redhat.com, pabeni@redhat.com, virtualization@lists.linux.dev, parav@nvidia.com, yohadt@nvidia.com, xuanzhuo@linux.alibaba.com, eperezma@redhat.com, jgg@ziepe.ca, kevin.tian@intel.com, kuba@kernel.org, andrew+netdev@lunn.ch, edumazet@google.com, danielj@nvidia.com References: <20260831161109.2999926-7-shshitrit@nvidia.com> <178835474310.3394541.14237006399257303655@kernel.org> Content-Language: en-US From: Shahar Shitrit In-Reply-To: <178835474310.3394541.14237006399257303655@kernel.org> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-ClientProxiedBy: TLZP290CA0012.ISRP290.PROD.OUTLOOK.COM (2603:1096:950:9::10) To BL0PR12MB5505.namprd12.prod.outlook.com (2603:10b6:208:1ce::7) X-Mailing-List: netdev@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL0PR12MB5505:EE_|CY3PR12MB9704:EE_ X-MS-Office365-Filtering-Correlation-Id: dfd8ed3a-f8a4-42fd-4940-08df4fb8e660 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|376014|7416014|1800799024|23010399003|4143699003|11063799006|5023799004|261009223027099003|22082099003|6133799003|18002099003|3023799007|56012099006|261028144727099003|261021121427099003|10067099003|261022105027099003|261026140227099003|261102123227099003|261026121527099003|261021123027099003|261022075727099003; X-Microsoft-Antispam-Message-Info: A73yJZ7ici3in6QN525jZiXhBJihaaqpAIc4eDLlqVfQvodxgpvNE6N868PjF7jF5YI0CFmaYTiytvVlv7YDvhDoUU7nzUsmW8lqCPHx6Lhpya+YM24aKkp97Bpe3iOyg6EpFIGHqC5znShEtZtmBjHLcZFyKsUpAJfC+pgSjPKevNYqME4mGtI+bIk/XvHLVKcviOjwlx6TLfvYBFngzwCrGIfm7rTNaIn4Itp5XqHVEhicPhWWCc+ratOgN3f2o2yIjUtctiAh7pKPIBZ+ynpLjnGAbCj14e73CPs7I+9D15tM5lTM6QgRKmfOu7SJOVaJJgytWgyEnZrlt5NrYxjEHG6EXTjgLOWW6j58UVHDuTSPaoOy84S553/ODRtsiHlwNTD/njHW9ZyFfe2HJ7eMrBc2f0AwQSgq+MjUEIsI1aZvjiRyLK0c9bDRd5FvxQrq5bq2q+1iAVSYTEqknkcqJHnhV1Nli9iZdigUZm39w/zwlKYpCfWMqievXEmZAAkdO3OJ/bjeNcx856gROrUhdybjqVevgRQm8nj298OT5HAchjxEy3KO0+OoLXwjCw2s+Znz3trQpAtsGMFvSJYWOueDjRGbd+RiQLXg8r6owLq+MfmNPzfGPXXnwKyH4KD1c01+7HnF/Nww1LI2N2yhCGlL2mulmjEjhC/1EYM= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BL0PR12MB5505.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(366016)(376014)(7416014)(1800799024)(23010399003)(4143699003)(11063799006)(5023799004)(261009223027099003)(22082099003)(6133799003)(18002099003)(3023799007)(56012099006)(261028144727099003)(261021121427099003)(10067099003)(261022105027099003)(261026140227099003)(261102123227099003)(261026121527099003)(261021123027099003)(261022075727099003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?L2NTRHc1WUZib2Y2N2NpVHNaSkxURVZDL2VWMVVLOTdkb3ZSZ2ljYVBmV3px?= =?utf-8?B?aC9LOXRjOVQzTVpCNlkvM3VpdzJ6YmlaNXpUSVZWRCtvVXEwZ2hndEY3aUNR?= =?utf-8?B?SzQwS2QyNHBsQUNxbWJwdkxxUG92ZDU5WHZzMmE0bnpFaStEYVFnMjBxZDVs?= =?utf-8?B?Skh4NHFkWnBUYW5OL1ZoOWp4TnBvTlh6L0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-8?B?dVJJNmNzWWNXQVZkeTdTSldrQWtwT2hNTDJLVlAyYXNHZ3Z0Smh0RlVWSkg0?= =?utf-8?B?anJIajU3dUhmWFR4dk0zdWo0UFJlTmVLcnAzWUJ4c1JkWHNXRmptaE1ZU3cx?= =?utf-8?B?eUYraGcxODd1SWtTcTdVSXo0aTMwL3NuNWpqSTh3T0p1V1R3b3hhSmJYV3Q5?= =?utf-8?B?SHZNUEhvWDdNVnVYQzlnb1J4Yi9Tem9aNHFETUpNU3JEajd2eUg0RmJQM0JZ?= =?utf-8?B?cTRBalpna21xV1lhUkNHS2VaM3dZRjlvL0tYZ3owK1BEQUxRZHB2SFVqMzZo?= =?utf-8?B?aFVuMzRybmZ3eWtYN2dTVzgvMHZIa0hsRjFSempTWjlCNi9Ea1ZWdz09?= X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: dfd8ed3a-f8a4-42fd-4940-08df4fb8e660 X-MS-Exchange-CrossTenant-AuthSource: BL0PR12MB5505.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Dec 2026 14:39:26.9726 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: P5TprwdUk68YckogUXKrwrcd/JhHX5fJp0ZpO1X9de929qTDARbSFCMuXvzY3sT828kdWSxz+YEmAJq47HxBXA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY3PR12MB9704 On 02/09/2026 16:12, netdev-bot+sashiko@kernel.org wrote: > Thank you for your contribution! Sashiko AI review found 5 potential > issue(s) to consider: > > Critical: 0 · High: 1 · Medium: 3 · Low: 1 > > - [High] virtnet_ff_init() (drivers/net/virtio_net.c:5760) converts > device-reported capability data into hard errors (-EINVAL at 5809 when… > - [Medium] In virtnet_ff_init() the bail-out 'if (!ff->ff_actions->count) > goto err_ff_action;' (drivers/net/virtio_net.c:5852-5853) is taken… > - [Medium] virtnet_ff_init() commits driver capabilities to the device > with up to three VIRTIO_ADMIN_CMD_DRIVER_CAP_SET commands — RESOURCE… > - [Medium] virtnet_ff_init() issues up to seven virtio admin commands (1x > cap_id_list_query, 3x cap_get, 3x cap_set) with the global RTNL mutex… > - [Low] The patch's recorded author is Shahar Shitrit, but the Signed- > off-by chain starts with Daniel Jurgens and there is no Co-developed-… > > -- > > virtio_net: Query and set flow filter caps > > This patch queries the virtio_net flow filter resource, selector and action > capabilities with admin commands during probe and resume, and writes the > values back to the device with capability set commands. It also adds the > new uapi header include/uapi/linux/virtio_net_ff.h. > >> Signed-off-by: Daniel Jurgens >> Reviewed-by: Parav Pandit >> Signed-off-by: Shahar Shitrit > > [Severity: Low] > The recorded author of the commit is Shahar Shitrit, but the > Signed-off-by chain begins with Daniel Jurgens and there is no > Co-developed-by: line for him. > > Documentation/process/submitting-patches.rst asks that the chain of > custody start with the author, and that a non-author co-author be > recorded with Co-developed-by: immediately followed by their > Signed-off-by:. > > Should this carry "Co-developed-by: Daniel Jurgens " > above his Signed-off-by:, or a From: line naming him as author? > >> diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c >> index e34c52d059d39..4f78b881e493b 100644 >> --- a/drivers/net/virtio_net.c >> +++ b/drivers/net/virtio_net.c > > [ ... ] > >> @@ -5724,6 +5739,197 @@ static const struct netdev_stat_ops virtnet_stat_ops = { >> .get_base_stats = virtnet_get_base_stats, >> }; >> >> +static size_t get_mask_size(u16 type) >> +{ >> + switch (type) { >> + case VIRTIO_NET_FF_MASK_TYPE_ETH: >> + return sizeof(struct ethhdr); >> + case VIRTIO_NET_FF_MASK_TYPE_IPV4: >> + return sizeof(struct iphdr); >> + case VIRTIO_NET_FF_MASK_TYPE_IPV6: >> + return sizeof(struct ipv6hdr); >> + case VIRTIO_NET_FF_MASK_TYPE_TCP: >> + return sizeof(struct tcphdr); >> + case VIRTIO_NET_FF_MASK_TYPE_UDP: >> + return sizeof(struct udphdr); >> + } >> + >> + return 0; >> +} >> + >> +static int virtnet_ff_init(struct virtnet_ff *ff, struct virtio_device *vdev) >> +{ > > [ ... ] > >> + if (!le32_to_cpu(ff->ff_caps->groups_limit) || >> + !le32_to_cpu(ff->ff_caps->classifiers_limit) || >> + !le32_to_cpu(ff->ff_caps->rules_limit) || >> + !le32_to_cpu(ff->ff_caps->rules_per_group_limit) || >> + !ff->ff_caps->selectors_per_classifier_limit) { >> + err = -EINVAL; >> + goto err_ff; >> + } > > [Severity: High] > Should values reported by the device be fatal to probe here? > > virtnet_ff_init() returns -EINVAL whenever the device reports any of > groups_limit, classifiers_limit, rules_limit, rules_per_group_limit or > selectors_per_classifier_limit as zero, and -EPROTO from the selector > walk further down when a known selector type has a length other than > get_mask_size(type) or the reply is truncated. The three kzalloc()s can > also return -ENOMEM. > > Both callers only tolerate 0 and -EOPNOTSUPP: > > virtnet_probe() > err = virtnet_ff_init(&vi->ff, vi->vdev); > if (err && err != -EOPNOTSUPP) { > rtnl_unlock(); > goto free_unregister_netdev; > } > > virtnet_restore_up() > err = virtnet_ff_init(&vi->ff, vi->vdev); > if (err && err != -EOPNOTSUPP) { > rtnl_unlock(); > virtnet_freeze_down(vi->vdev); > remove_vq_common(vi); > return err; > } > > So a device that advertises the three capability ids but reports zero > limits, or reports a selector mask length that does not match the Linux > header sizes, makes probe fail and unregister the netdev, and on resume > tears down an already restored device. For a guest whose only interface > is virtio-net that removes the whole data path. > > The comment above both call sites says "Not supported is an acceptable and > common return code", which suggests the feature is optional. Would it be > better to leave ff_supported false and continue, the way an unknown > selector type is already handled with a break out of the loop, instead of > failing probe and resume? > >> + >> + /* VIRTIO_NET_FF_MASK_TYPE start at 1 */ >> + for (i = 1; i <= VIRTIO_NET_FF_MASK_TYPE_MAX; i++) >> + ff_mask_size += get_mask_size(i); >> + > Device might not support flow filters. However, a device that advertises flow filters with zero limits or a mismatched selector size is broken and we fail probe. > [ ... ] > >> + ff->ff_actions->count = min_t(u8, ff->ff_actions->count, >> + VIRTIO_NET_FF_ACTION_MAX); >> + if (!ff->ff_actions->count) >> + goto err_ff_action; > > [Severity: Medium] > Is err left at 0 on this branch? > > The preceding virtio_admin_cap_get() succeeded, which is what "if (err) > goto err_ff_action;" just established, so err is still 0 when the zero > action count is detected. The shared unwind path ends in: > > err_ff_action: > kfree(ff->ff_actions); > ff->ff_actions = NULL; > ... > return err; > > which returns 0 while ff_supported stays false and ff_caps/ff_mask/ > ff_actions are all NULL. Every other failure branch in the function > assigns -EOPNOTSUPP, -ENOMEM, -EINVAL or -EPROTO, so this looks like a > missing assignment. The count byte comes straight from the device reply, > so a device reporting zero actions makes virtnet_ff_init() report success > to both callers, which test only the return value. > >> + >> + err = virtio_admin_cap_set(vdev, >> + VIRTIO_NET_FF_RESOURCE_CAP, >> + ff->ff_caps, >> + sizeof(*ff->ff_caps)); >> + if (err) >> + goto err_ff_action; > Will fix: the zero action count branch will set err = -EINVAL before the goto. > [Severity: Medium] > What happens on the device side when the second or third capability set > fails after this one succeeded? > > virtnet_ff_init() commits three capabilities in sequence (resource, > selector, action), but the error labels only free the driver side copies: > > err_ff_action: > kfree(ff->ff_actions); > ff->ff_actions = NULL; > err_ff_mask: > kfree(ff->ff_mask); > ff->ff_mask = NULL; > err_ff: > kfree(ff->ff_caps); > ff->ff_caps = NULL; > > No compensating capability set and no device reset is issued, so the > device keeps the flow filter resource capability committed while the > driver has discarded the limits it agreed to and leaves ff_supported > false. > > vp_modern_admin_cmd_exec() turns the device reported admin status > directly into the errno: > > drivers/virtio/virtio_pci_modern.c:vp_modern_admin_cmd_exec() { > ... > ret = -status; > ... > } > > so a device answering the selector or action set with status 95 produces > -EOPNOTSUPP, which both call sites deliberately swallow. Probe and resume > then complete without reaching virtio_reset_device(), leaving the > half negotiated state in place. Should the unwind path undo the > capabilities that were already accepted? There's no admin command to revoke a driver capability, so there's nothing to roll back with. It's harmless: after a failure ff_supported stays false, so the driver never uses what was granted, and the device clears it on reset. > >> + >> + real_ff_mask_size = sizeof(struct virtio_net_ff_cap_mask_data); >> + sel = (void *)&ff->ff_mask->selectors; >> + >> + for (i = 0; i < ff->ff_mask->count; i++) { >> + /* If the selector type is unknown it may indicate the spec >> + * has been revised to include new types of selectors >> + */ >> + if (!sel->type || sel->type > VIRTIO_NET_FF_MASK_TYPE_MAX) >> + break; >> + >> + if (sel->length != get_mask_size(sel->type) || >> + test_and_set_bit(sel->type, &sel_types)) { >> + err = -EPROTO; >> + goto err_ff_action; >> + } >> + real_ff_mask_size += sizeof(*sel) + sel->length; >> + if (real_ff_mask_size > ff_mask_size) { >> + err = -EPROTO; >> + goto err_ff_action; >> + } >> + sel = (void *)sel + sizeof(*sel) + sel->length; >> + } >> + ff->ff_mask->count = i; > > [ ... ] > >> @@ -5771,9 +5981,24 @@ static int virtnet_restore_up(struct virtio_device *vdev) >> goto err_destroy_pools; >> } >> >> + /* >> + * Initialize flow filters. Not supported is an acceptable and common >> + * return code >> + */ >> + rtnl_lock(); >> + err = virtnet_ff_init(&vi->ff, vi->vdev); >> + if (err && err != -EOPNOTSUPP) { >> + rtnl_unlock(); >> + virtnet_freeze_down(vi->vdev); >> + remove_vq_common(vi); >> + return err; >> + } >> + rtnl_unlock(); > > [Severity: Medium] > Does this need to run with RTNL held? > > virtnet_ff_init() issues up to seven admin commands (one cap id list > query, three cap gets, three cap sets), and each one ends in an > uninterruptible wait with no timeout: > > drivers/virtio/virtio_pci_modern.c:virtqueue_exec_admin_cmd() { > ... > again: > if (virtqueue_is_broken(vq)) > ... > ... > wait_for_completion(&cmd->completion); > ... > } > > virtqueue_is_broken() is only checked before the kick, and there is no > interruptible variant or fallback wake after it, so a device that never > completes the command never returns. This hunk adds a new > rtnl_lock()/rtnl_unlock() section around the call on the resume path, and > virtnet_probe() calls it inside the existing RTNL section, so the global > RTNL mutex is held across those device round trips. While it is held, > every netdev register/unregister and ip/ethtool operation on all > interfaces blocks, not just this device. > > For comparison, the pre-existing control vq path in this driver > (virtnet_send_command) polls with a virtqueue_is_broken() escape. Is > there something in virtnet_ff_init() that requires RTNL at these two > points? > >> netif_tx_lock_bh(vi->dev); >> netif_device_attach(vi->dev); >> netif_tx_unlock_bh(vi->dev); >> + >> return 0; >> >> err_destroy_pools: > RTNL is what serializes vi->ff: it has no lock of its own, and the ethtool rxnfc ops in the later patches access it under RTNL. In probe the netdev is already registered, and virtnet_freeze_down() takes RTNL around ff_cleanup, so the lock in virtnet_restore_up() pairs with it. Dropping it would let ethtool race with ff_init. > [ ... ] > >> @@ -7057,6 +7282,15 @@ static int virtnet_probe(struct virtio_device *vdev) >> >> virtio_device_ready(vdev); >> >> + /* Initialize flow filters. Not supported is an acceptable and common >> + * return code >> + */ >> + err = virtnet_ff_init(&vi->ff, vi->vdev); >> + if (err && err != -EOPNOTSUPP) { >> + rtnl_unlock(); >> + goto free_unregister_netdev; >> + } >> + > > [ ... ] >