Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S937848AbdDSUud (ORCPT ); Wed, 19 Apr 2017 16:50:33 -0400 Received: from a2nlsmtp01-04.prod.iad2.secureserver.net ([198.71.225.38]:41154 "EHLO a2nlsmtp01-04.prod.iad2.secureserver.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S937748AbdDSUu3 (ORCPT ); Wed, 19 Apr 2017 16:50:29 -0400 x-originating-ip: 107.180.71.197 From: kys@exchange.microsoft.com To: davem@davemloft.net, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, devel@linuxdriverproject.org, olaf@aepfle.de, apw@canonical.com, jasowang@redhat.com, leann.ogasawara@canonical.comi, marcelo.cerri@canonical.com, sthemmin@microsoft.com Cc: "K. Y. Srinivasan" Subject: [PATCH 1/1] netvsc: Deal with rescinded channels correctly Date: Wed, 19 Apr 2017 13:49:19 -0700 Message-Id: <1492634959-28942-1-git-send-email-kys@exchange.microsoft.com> X-Mailer: git-send-email 1.7.1 Reply-To: kys@microsoft.com X-CMAE-Envelope: MS4wfLUMBJeMZlR4VXHMoFvsUgl9AUZ0w7mBY145tPgQqszyBT7YNmuTFosXgudtNlscjAnzemvO5BibGRRHdBfWcda+PNPfSvoGXuqPae2F44bGGcm8Jm5w jkjO/dRDnneDCpGJ0NQPLU8PBgFJ8EUcFa8LKw26OemeUC17bJGC3ZoqLqtyo7eZrtIzKTKWhfIvdAfnCq9caxOm+bt/i5xIxvpxNO1k2gNkd7sntJbyW8Tj VEZxaYPnYu1hylK/k0H5aQr4l0mX7vS93XsmSU2the2DM+eRv4YF2LV/rGp9ZDryqJadXxS/gz2ihJFxLY19ZHlia9hp4oBRyzoYGLShaEIeRPhF2mUE5jFB 3IUgLf+MhLdAnkhjl26ZfNGDXMF4DlGqQGlRcfQS4kV1Db0to8jmOBze0XC4hg+SE2HNkEV8Sl6E+4vW+yhHSMEjkgAesQ2tY1nUiciCpgOgRJjnyn6v00oD mEvA20rowYjjEEqea6NoLn+rVzCvcKXlDnCZgY3+m5a10q38DovZ2Cz8T4o= Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1766 Lines: 48 From: K. Y. Srinivasan We will not be able to send packets over a channel that has been rescinded. Make necessary adjustments so we can properly cleanup even when the channel is rescinded. This issue can be trigerred in the NIC hot-remove path. Signed-off-by: K. Y. Srinivasan --- drivers/net/hyperv/netvsc.c | 16 ++++++++++++++++ 1 files changed, 16 insertions(+), 0 deletions(-) diff --git a/drivers/net/hyperv/netvsc.c b/drivers/net/hyperv/netvsc.c index 7ab06b3..b5b10fc 100644 --- a/drivers/net/hyperv/netvsc.c +++ b/drivers/net/hyperv/netvsc.c @@ -135,6 +135,13 @@ static void netvsc_destroy_buf(struct hv_device *device) sizeof(struct nvsp_message), (unsigned long)revoke_packet, VM_PKT_DATA_INBAND, 0); + /* If the failure is because the channel is rescinded; + * ignore the failure since we cannot send on a rescinded + * channel. This would allow us to properly cleanup + * even when the channel is rescinded. + */ + if (device->channel->rescind) + ret = 0; /* * If we failed here, we might as well return and * have a leak rather than continue and a bugchk @@ -195,6 +202,15 @@ static void netvsc_destroy_buf(struct hv_device *device) sizeof(struct nvsp_message), (unsigned long)revoke_packet, VM_PKT_DATA_INBAND, 0); + + /* If the failure is because the channel is rescinded; + * ignore the failure since we cannot send on a rescinded + * channel. This would allow us to properly cleanup + * even when the channel is rescinded. + */ + if (device->channel->rescind) + ret = 0; + /* If we failed here, we might as well return and * have a leak rather than continue and a bugchk */ -- 1.7.1