From patchwork Sat Nov 22 10:08:52 2008 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Bernard Pidoux X-Patchwork-Id: 10214 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by ozlabs.org (Postfix) with ESMTP id 31EF0DDDFB for ; Sat, 22 Nov 2008 21:11:40 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753573AbYKVKLV (ORCPT ); Sat, 22 Nov 2008 05:11:21 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1753508AbYKVKLU (ORCPT ); Sat, 22 Nov 2008 05:11:20 -0500 Received: from smtp1-g19.free.fr ([212.27.42.27]:58533 "EHLO smtp1-g19.free.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753410AbYKVKLT convert rfc822-to-8bit (ORCPT ); Sat, 22 Nov 2008 05:11:19 -0500 Received: from smtp1-g19.free.fr (localhost.localdomain [127.0.0.1]) by smtp1-g19.free.fr (Postfix) with ESMTP id CC99A1AB323; Sat, 22 Nov 2008 11:11:16 +0100 (CET) Received: from f6bvp-11 (car75-2-82-66-61-83.fbx.proxad.net [82.66.61.83]) by smtp1-g19.free.fr (Postfix) with ESMTP id 7A8591AB31F; Sat, 22 Nov 2008 11:11:16 +0100 (CET) From: Bernard Pidoux Reply-To: f6bvp@amsat.org Organization: amsat.org To: Linux Netdev , Linux Hams Subject: [PATCH] [ROSE] zero length frame filtering in af_rose.c Date: Sat, 22 Nov 2008 11:08:52 +0100 User-Agent: KMail/1.9.6 Cc: Ralf DL5RB , David Miller MIME-Version: 1.0 Content-Disposition: inline Message-Id: <200811221108.54242.bpidoux@free.fr> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Since changeset e79ad711a0108475c1b3a03815527e7237020b08 from  mainline. From: David S. Miller empty packet can be transmitted on connected socket for datagram protocols. However, this patch broke a high level application using ROSE network protocole with connected datagram. Bulletin Board Stations perform bulletins forwarding between BBS stations by   radio and ROSE network using a forward protocole. Now, if for some reason, a sending buffer in the application software happens to be empty at a specific moment, ROSE relays an empty packet via unfiltred packet socket. When received, this ROSE packet introduces perturbations of BBS data forwarding protocole, for the application protocole is waiting for something else than an empty packet. We agree that a more carefull programming of the application protocole would avoid this situation and we are willing to debug it. But, as an empty frame is no use, and does not have any meaning for ROSE protocole, we may consider filtering zero length data both when sending and receiving socket data. The proposed patch repairs BBS data exchange through ROSE network that were broken since 2.6.22.11 kernel. Signed-off-by: Bernard Pidoux ---  net/rose/af_rose.c |   10 ++++++++++  1 files changed, 10 insertions(+), 0 deletions(-)   @@ -1268,6 +1272,12 @@ static int rose_recvmsg(struct kiocb *iocb, struct socket *sock,         skb_reset_transport_header(skb);         copied     = skb->len;   +       /* ROSE empty frame has no meaning : ignore it */ +       if (copied == 0) { +               skb_free_datagram(sk, skb); +               return copied; +       } +         if (copied > size) {                 copied = size;                 msg->msg_flags |= MSG_TRUNC; diff --git a/net/rose/af_rose.c b/net/rose/af_rose.c index 8a54cff..92af3a6 100644 --- a/net/rose/af_rose.c +++ b/net/rose/af_rose.c @@ -1075,6 +1075,10 @@ static int rose_sendmsg(struct kiocb *iocb, struct socket *sock,         unsigned char *asmptr;         int n, size, qbit = 0;   +       /* ROSE empty frame has no meaning : don't send */ +       if (len == 0) +               return 0; +         if (msg->msg_flags & ~(MSG_DONTWAIT|MSG_EOR|MSG_CMSG_COMPAT))                 return -EINVAL;