Wind River Support Network

HomeDefectsLIN5-18885
Fixed

LIN5-18885 : CLONE - tftp can send ack even if the space is full.

Created: Jun 11, 2014    Updated: Dec 19, 2017
Resolved Date: Jun 17, 2014
Previous ID: LIN4-31484
Found In Version: 5.0
Fix Version: 5.0.1.16
Severity: Critical
Applicable for: Wind River Linux 5
Component/s: Networking

Description

the doubtful ode:
static void tftp_recvfile(struct formats *pf, struct tftphdr *oap, int oacklen)
{
        ...
        ...
        /*size = write(file, dp->th_data, n - 4); */
        size = writeit(file, &dp, n - 4, pf->f_convert);//

this mechanics was modified by some one patch of RCPL.
maybe this lead to this issue???????????????


        if (size != (n - 4)) {  /* ahem */
            if (size < 0)
                nak(errno + 100, NULL);
            else
                nak(ENOSPACE, NULL);
            goto abort;
        }
    } while (size == segsize);
}
 
/* Update count associated with the buffer, get new buffer
   from the queue.  Calls write_behind only if next buffer not
   available.
 */
int writeit(FILE * file, struct tftphdr **dpp, int ct, int convert)
{
    bfs[current].counter = ct;  /* set size of data to write */
    current = !current;         /* switch to other buffer */
    if (bfs[current].counter != BF_FREE)        /* if not free */
        (void)write_behind(file, convert);      /* flush it */
    bfs[current].counter = BF_ALLOC;    /* mark as alloc'd */
    *dpp = (struct tftphdr *)bfs[current].buf;
    return ct;                  /* this is a lie of course */
}
 
after upload a file to a folder fullfilled, we can see the file size is 0, but the ack shows that the upload is success.

Steps to Reproduce

1setup.log and config.log please see attachment.
2 compile tftp-hda intofs
3fill a folder full with files
3 upload a file to the fullfilled folder by tftp
tftp -l image.hpm -p 172.31.1.165
4root@SMM:/tmp# cd tftp/
root@SMM:/tmp/tftp# ls -l
drwxrwxrwx   34 root     root          680 May  6 20:32 download
-rw-rw-rw-    1 nobody   nobody          0 May  7 08:42 firmware_image.hpm
drwxrwxrwx    2 root     root           40 May  6 20:32 upload
5 catch the package by tool you can see the server has responsed the normal ack.

Other Downloads


Live chat
Online