02 Mar, 2011

1 commit

  • This fixes a bug in the order of dccp_rcv_state_process() that still permitted
    reception even after closing the socket. A Reset after close thus causes a NULL
    pointer dereference by not preventing operations on an already torn-down socket.

    dccp_v4_do_rcv()
    |
    | state other than OPEN
    v
    dccp_rcv_state_process()
    |
    | DCCP_PKT_RESET
    v
    dccp_rcv_reset()
    |
    v
    dccp_time_wait()

    WARNING: at net/ipv4/inet_timewait_sock.c:141 __inet_twsk_hashdance+0x48/0x128()
    Modules linked in: arc4 ecb carl9170 rt2870sta(C) mac80211 r8712u(C) crc_ccitt ah
    [] (unwind_backtrace+0x0/0xec) from [] (warn_slowpath_common)
    [] (warn_slowpath_common+0x4c/0x64) from [] (warn_slowpath_n)
    [] (warn_slowpath_null+0x1c/0x24) from [] (__inet_twsk_hashd)
    [] (__inet_twsk_hashdance+0x48/0x128) from [] (dccp_time_wai)
    [] (dccp_time_wait+0x40/0xc8) from [] (dccp_rcv_state_proces)
    [] (dccp_rcv_state_process+0x120/0x538) from [] (dccp_v4_do_)
    [] (dccp_v4_do_rcv+0x11c/0x14c) from [] (release_sock+0xac/0)
    [] (release_sock+0xac/0x110) from [] (dccp_close+0x28c/0x380)
    [] (dccp_close+0x28c/0x380) from [] (inet_release+0x64/0x70)

    The fix is by testing the socket state first. Receiving a packet in Closed state
    now also produces the required "No connection" Reset reply of RFC 4340, 8.3.1.

    Reported-and-tested-by: Johan Hovold
    Cc: stable@kernel.org
    Signed-off-by: Gerrit Renker
    Signed-off-by: David S. Miller

    Gerrit Renker
     

14 Jan, 2011

1 commit

  • * 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial: (43 commits)
    Documentation/trace/events.txt: Remove obsolete sched_signal_send.
    writeback: fix global_dirty_limits comment runtime -> real-time
    ppc: fix comment typo singal -> signal
    drivers: fix comment typo diable -> disable.
    m68k: fix comment typo diable -> disable.
    wireless: comment typo fix diable -> disable.
    media: comment typo fix diable -> disable.
    remove doc for obsolete dynamic-printk kernel-parameter
    remove extraneous 'is' from Documentation/iostats.txt
    Fix spelling milisec -> ms in snd_ps3 module parameter description
    Fix spelling mistakes in comments
    Revert conflicting V4L changes
    i7core_edac: fix typos in comments
    mm/rmap.c: fix comment
    sound, ca0106: Fix assignment to 'channel'.
    hrtimer: fix a typo in comment
    init/Kconfig: fix typo
    anon_inodes: fix wrong function name in comment
    fix comment typos concerning "consistent"
    poll: fix a typo in comment
    ...

    Fix up trivial conflicts in:
    - drivers/net/wireless/iwlwifi/iwl-core.c (moved to iwl-legacy.c)
    - fs/ext4/ext4.h

    Also fix missed 'diabled' typo in drivers/net/bnx2x/bnx2x.h while at it.

    Linus Torvalds
     

07 Jan, 2011

3 commits

  • The 'seq_window' sysctl sets the initial value for the DCCP Sequence Window,
    which may range from 32..2^46-1 (RFC 4340, 7.5.2). The patch sets the upper
    bound consistently to 2^32-1 on both 32 and 64 bit systems, which should be
    sufficient - with a RTT of 1sec and 1-byte packets, a seq_window of 2^32-1
    corresponds to a link speed of 34 Gbps.

    Signed-off-by: Gerrit Renker

    Gerrit Renker
     
  • Currently dccp_check_seqno allows any valid packet to update the Greatest
    Sequence Number Received, even if that packet's sequence number is less than
    the current GSR. This patch adds a check to make sure that the new packet's
    sequence number is greater than GSR.

    Signed-off-by: Samuel Jero
    Signed-off-by: Gerrit Renker

    Samuel Jero
     
  • Currently dccp_check_seqno returns 0 (indicating a valid packet) if the
    acknowledgment number is out of bounds and the sync that RFC 4340 mandates at
    this point is currently being rate-limited. This function should return -1,
    indicating an invalid packet.

    Signed-off-by: Samuel Jero
    Acked-by: Gerrit Renker

    Samuel Jero
     

23 Dec, 2010

1 commit


10 Dec, 2010

1 commit

  • Remove macros which have been unused since the initial implementation
    (commit 7c657876b63cb1d8a2ec06f8fc6c37bb8412e66c, [DCCP]: Initial
    implementation from Tue Aug 9 20:14:34 2005 -0700).

    Signed-off-by: Shan Wei
    Acked-by: Gerrit Renker

    Shan Wei
     

09 Dec, 2010

1 commit


07 Dec, 2010

2 commits

  • Ensure that cmsg->cmsg_type value is valid for qpolicy
    that is currently in use.

    Signed-off-by: Tomasz Grobelny
    Signed-off-by: Gerrit Renker

    Tomasz Grobelny
     
  • This patch adds a generic infrastructure for policy-based dequeueing of
    TX packets and provides two policies:
    * a simple FIFO policy (which is the default) and
    * a priority based policy (set via socket options).
    Both policies honour the tx_qlen sysctl for the maximum size of the write
    queue (can be overridden via socket options).

    The priority policy uses skb->priority internally to assign an u32 priority
    identifier, using the same ranking as SO_PRIORITY. The skb->priority field
    is set to 0 when the packet leaves DCCP. The priority is supplied as ancillary
    data using cmsg(3), the patch also provides the requisite parsing routines.

    Signed-off-by: Tomasz Grobelny
    Signed-off-by: Gerrit Renker

    Tomasz Grobelny
     

29 Nov, 2010

1 commit

  • This fixes a bug in updating the Greatest Acknowledgment number Received (GAR):
    the current implementation does not track the greatest received value -
    lower values in the range AWL..AWH (RFC 4340, 7.5.1) erase higher ones.

    Signed-off-by: Gerrit Renker
    Signed-off-by: David S. Miller

    Gerrit Renker
     

19 Nov, 2010

1 commit

  • This fixes whitespace noise introduced in commit "dccp ccid-2: Algorithm to
    update buffer state", 5753fdfe8bd8e9a2ff9e5af19b0ffc78bfcd502a, 14 Nov 2010.

    Signed-off-by: Gerrit Renker
    Signed-off-by: David S. Miller

    Gerrit Renker
     

18 Nov, 2010

1 commit


16 Nov, 2010

1 commit

  • Some of the documentation refers to web pages under
    the domain `osdl.org'. However, `osdl.org' now
    redirects to `linuxfoundation.org'.

    Rather than rely on redirections, this patch updates
    the addresses appropriately; for the most part, only
    documentation that is meant to be current has been
    updated.

    The patch should be pretty quick to scan and check;
    each new web-page url was gotten by trying out the
    original URL in a browser and then simply copying the
    the redirected URL (formatting as necessary).

    There is some conflict as to which one of these domain
    names is preferred:

    linuxfoundation.org
    linux-foundation.org

    So, I wrote:

    info@linuxfoundation.org

    and got this reply:

    Message-ID:
    Date: Mon, 15 Nov 2010 10:41:42 -0800
    From: David Ames

    ...

    linuxfoundation.org is preferred. The canonical name for our web site is
    www.linuxfoundation.org. Our list site is actually
    lists.linux-foundation.org.

    Regarding email linuxfoundation.org is preferred there are a few people
    who choose to use linux-foundation.org for their own reasons.

    Consequently, I used `linuxfoundation.org' for web pages and
    `lists.linux-foundation.org' for mailing-list web pages and email addresses;
    the only personal email address I updated from `@osdl.org' was that of
    Andrew Morton, who prefers `linux-foundation.org' according `git log'.

    Signed-off-by: Michael Witten
    Signed-off-by: Jiri Kosina

    Michael Witten
     

15 Nov, 2010

6 commits

  • This patch replaces an almost identical replication of code: large parts
    of dccp_parse_options() re-appeared as ccid2_ackvector() in ccid2.c.

    Apart from the duplication, this caused two more problems:
    1. CCIDs should not need to be concerned with parsing header options;
    2. one can not assume that Ack Vectors appear as a contiguous area within an
    skb, it is legal to insert other options and/or padding in between. The
    current code would throw an error and stop reading in such a case.

    Since Ack Vectors provide CCID-specific information, they are now processed
    by the CCID directly, separating this functionality from the main DCCP code.

    Signed-off-by: Gerrit Renker

    Gerrit Renker
     
  • This removes
    * functions for which updates have been provided in the preceding patches and
    * the @av_vec_len field - it is no longer necessary since the buffer length is
    now always computed dynamically.

    Signed-off-by: Gerrit Renker

    Gerrit Renker
     
  • The problem with Ack Vectors is that
    i) their length is variable and can in principle grow quite large,
    ii) it is hard to predict exactly how large they will be.

    Due to the second point it seems not a good idea to reduce the MPS; in
    particular when on average there is enough room for the Ack Vector and an
    increase in length is momentarily due to some burst loss, after which the
    Ack Vector returns to its normal/average length.

    The solution taken by this patch is to subtract a minimum-expected Ack Vector
    length from the MPS, and to defer any larger Ack Vectors onto a separate
    Sync - but only if indeed there is no space left on the skb.

    This patch provides the infrastructure to schedule Sync-packets for transporting
    (urgent) out-of-band data. Its signalling is quicker than scheduling an Ack, since
    it does not need to wait for new application data.

    Signed-off-by: Gerrit Renker

    Gerrit Renker
     
  • This aggregates Ack Vector processing (handling input and clearing old state)
    into one function, for the following reasons and benefits:
    * all Ack Vector-specific processing is now in one place;
    * duplicated code is removed;
    * ensuring sanity: from an Ack Vector point of view, it is better to clear the
    old state first before entering new state;
    * Ack Event handling happens mostly within the CCIDs, not the main DCCP module.

    Signed-off-by: Gerrit Renker

    Gerrit Renker
     
  • This patch updates the code which registers new packets as received, using the
    new circular buffer interface. It contributes a new algorithm which
    * supports both tail/head pointers and buffer wrap-around and
    * deals with overflow (head/tail move in lock-step).

    Signed-off-by: Gerrit Renker

    Gerrit Renker
     
  • This provides a routine to consistently update the buffer state when the
    peer acknowledges receipt of Ack Vectors; updating state in the list of Ack
    Vectors as well as in the circular buffer.

    While based on RFC 4340, several additional (and necessary) precautions were
    added to protect the consistency of the buffer state. These additions are
    essential, since analysis and experience showed that the basic algorithm was
    insufficient for this task (which lead to problems that were hard to debug).

    The algorithm now
    * deals with HC-sender acknowledging to HC-receiver and vice versa,
    * keeps track of the last unacknowledged but received seqno in tail_ackno,
    * has special cases to reset the overflow condition when appropriate,
    * is protected against receiving older information (would mess up buffer state).

    Signed-off-by: Gerrit Renker

    Gerrit Renker
     

11 Nov, 2010

3 commits

  • This completes the implementation of a circular buffer for Ack Vectors, by
    extending the current (linear array-based) implementation. The changes are:

    (a) An `overflow' flag to deal with the case of overflow. As before, dynamic
    growth of the buffer will not be supported; but code will be added to deal
    robustly with overflowing Ack Vector buffers.

    (b) A `tail_seqno' field. When naively implementing the algorithm of Appendix A
    in RFC 4340, problems arise whenever subsequent Ack Vector records overlap,
    which can bring the entire run length calculation completely out of synch.
    (This is documented on http://www.erg.abdn.ac.uk/users/gerrit/dccp/notes/\
    ack_vectors/tracking_tail_ackno/ .)
    (c) The buffer length is now computed dynamically (i.e. current fill level),
    as the span between head to tail.

    As a result, dccp_ackvec_pending() is now simpler - the #ifdef is no longer
    necessary since buf_empty is always true when IP_DCCP_ACKVEC is not configured.

    Signed-off-by: Gerrit Renker

    Gerrit Renker
     
  • This patch
    * separates Ack Vector housekeeping code from option-insertion code;
    * shifts option-specific code from ackvec.c into options.c;
    * introduces a dedicated routine to take care of the Ack Vector records;
    * simplifies the dccp_ackvec_insert_avr() routine: the BUG_ON was redundant,
    since the list is automatically arranged in descending order of ack_seqno.

    Signed-off-by: Gerrit Renker

    Gerrit Renker
     
  • This patch brings the Ack Vector interface up to date. Its main purpose is
    to lay the basis for the subsequent patches of this set, which will use the
    new data structure fields and routines.

    There are no real algorithmic changes, rather an adaptation:

    (1) Replaced the static Ack Vector size (2) with a #define so that it can
    be adapted (with low loss / Ack Ratio, a value of 1 works, so 2 seems
    to be sufficient for the moment) and added a solution so that computing
    the ECN nonce will continue to work - even with larger Ack Vectors.

    (2) Replaced the #defines for Ack Vector states with a complete enum.

    (3) Replaced #defines to compute Ack Vector length and state with general
    purpose routines (inlines), and updated code to use these.

    (4) Added a `tail' field (conversion to circular buffer in subsequent patch).

    (5) Updated the (outdated) documentation for Ack Vector struct.

    (6) All sequence number containers now trimmed to 48 bits.

    (7) Removal of unused bits:
    * removed dccpav_ack_nonce from struct dccp_ackvec, since this is already
    redundantly stored in the `dccpavr_ack_nonce' (of Ack Vector record);
    * removed Elapsed Time for Ack Vectors (it was nowhere used);
    * replaced semantics of dccpavr_sent_len with dccpavr_ack_runlen, since
    the code needs to be able to remember the old run length;
    * reduced the de-/allocation routines (redundant / duplicate tests).

    Signed-off-by: Gerrit Renker

    Gerrit Renker
     

29 Oct, 2010

4 commits

  • This updates CCID-2 to use the CCID dequeuing mechanism, converting from
    previous continuous-polling to a now event-driven mechanism.

    Signed-off-by: Gerrit Renker
    Signed-off-by: David S. Miller

    Gerrit Renker
     
  • This extends the existing wait-for-ccid routine so that it may be used with
    different types of CCID, addressing the following problems:

    1) The queue-drain mechanism only works with rate-based CCIDs. If CCID-2 for
    example has a full TX queue and becomes network-limited just as the
    application wants to close, then waiting for CCID-2 to become unblocked
    could lead to an indefinite delay (i.e., application "hangs").
    2) Since each TX CCID in turn uses a feedback mechanism, there may be changes
    in its sending policy while the queue is being drained. This can lead to
    further delays during which the application will not be able to terminate.
    3) The minimum wait time for CCID-3/4 can be expected to be the queue length
    times the current inter-packet delay. For example if tx_qlen=100 and a delay
    of 15 ms is used for each packet, then the application would have to wait
    for a minimum of 1.5 seconds before being allowed to exit.
    4) There is no way for the user/application to control this behaviour. It would
    be good to use the timeout argument of dccp_close() as an upper bound. Then
    the maximum time that an application is willing to wait for its CCIDs to can
    be set via the SO_LINGER option.

    These problems are addressed by giving the CCID a grace period of up to the
    `timeout' value.

    The wait-for-ccid function is, as before, used when the application
    (a) has read all the data in its receive buffer and
    (b) if SO_LINGER was set with a non-zero linger time, or
    (c) the socket is either in the OPEN (active close) or in the PASSIVE_CLOSEREQ
    state (client application closes after receiving CloseReq).

    In addition, there is a catch-all case of __skb_queue_purge() after waiting for
    the CCID. This is necessary since the write queue may still have data when
    (a) the host has been passively-closed,
    (b) abnormal termination (unread data, zero linger time),
    (c) wait-for-ccid could not finish within the given time limit.

    Signed-off-by: Gerrit Renker
    Signed-off-by: David S. Miller

    Gerrit Renker
     
  • This extends the packet dequeuing interface of dccp_write_xmit() to allow
    1. CCIDs to take care of timing when the next packet may be sent;
    2. delayed sending (as before, with an inter-packet gap up to 65.535 seconds).

    The main purpose is to take CCID-2 out of its polling mode (when it is network-
    limited, it tries every millisecond to send, without interruption).

    The mode of operation for (2) is as follows:
    * new packet is enqueued via dccp_sendmsg() => dccp_write_xmit(),
    * ccid_hc_tx_send_packet() detects that it may not send (e.g. window full),
    * it signals this condition via `CCID_PACKET_WILL_DEQUEUE_LATER',
    * dccp_write_xmit() returns without further action;
    * after some time the wait-condition for CCID becomes true,
    * that CCID schedules the tasklet,
    * tasklet function calls ccid_hc_tx_send_packet() via dccp_write_xmit(),
    * since the wait-condition is now true, ccid_hc_tx_packet() returns "send now",
    * packet is sent, and possibly more (since dccp_write_xmit() loops).

    Code reuse: the taskled function calls dccp_write_xmit(), the timer function
    reduces to a wrapper around the same code.

    Signed-off-by: Gerrit Renker
    Signed-off-by: David S. Miller

    Gerrit Renker
     
  • This patch reorganises the return value convention of the CCID TX sending
    function, to permit more flexible schemes, as required by subsequent patches.

    Currently the convention is
    * values < 0 mean error,
    * a value == 0 means "send now", and
    * a value x > 0 means "send in x milliseconds".

    The patch provides symbolic constants and a function to interpret return values.

    In addition, it caps the maximum positive return value to 0xFFFF milliseconds,
    corresponding to 65.535 seconds. This is possible since in CCID-3/4 the
    maximum possible inter-packet gap is fixed at t_mbi = 64 sec.

    Signed-off-by: Gerrit Renker
    Signed-off-by: David S. Miller

    Gerrit Renker
     

24 Oct, 2010

1 commit

  • * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next-2.6: (1699 commits)
    bnx2/bnx2x: Unsupported Ethtool operations should return -EINVAL.
    vlan: Calling vlan_hwaccel_do_receive() is always valid.
    tproxy: use the interface primary IP address as a default value for --on-ip
    tproxy: added IPv6 support to the socket match
    cxgb3: function namespace cleanup
    tproxy: added IPv6 support to the TPROXY target
    tproxy: added IPv6 socket lookup function to nf_tproxy_core
    be2net: Changes to use only priority codes allowed by f/w
    tproxy: allow non-local binds of IPv6 sockets if IP_TRANSPARENT is enabled
    tproxy: added tproxy sockopt interface in the IPV6 layer
    tproxy: added udp6_lib_lookup function
    tproxy: added const specifiers to udp lookup functions
    tproxy: split off ipv6 defragmentation to a separate module
    l2tp: small cleanup
    nf_nat: restrict ICMP translation for embedded header
    can: mcp251x: fix generation of error frames
    can: mcp251x: fix endless loop in interrupt handler if CANINTF_MERRF is set
    can-raw: add msg_flags to distinguish local traffic
    9p: client code cleanup
    rds: make local functions/variables static
    ...

    Fix up conflicts in net/core/dev.c, drivers/net/pcmcia/smc91c92_cs.c and
    drivers/net/wireless/ath/ath9k/debug.c as per David

    Linus Torvalds
     

21 Oct, 2010

2 commits


15 Oct, 2010

1 commit

  • All file_operations should get a .llseek operation so we can make
    nonseekable_open the default for future file operations without a
    .llseek pointer.

    The three cases that we can automatically detect are no_llseek, seq_lseek
    and default_llseek. For cases where we can we can automatically prove that
    the file offset is always ignored, we use noop_llseek, which maintains
    the current behavior of not returning an error from a seek.

    New drivers should normally not use noop_llseek but instead use no_llseek
    and call nonseekable_open at open time. Existing drivers can be converted
    to do the same when the maintainer knows for certain that no user code
    relies on calling seek on the device file.

    The generated code is often incorrectly indented and right now contains
    comments that clarify for each added line why a specific variant was
    chosen. In the version that gets submitted upstream, the comments will
    be gone and I will manually fix the indentation, because there does not
    seem to be a way to do that using coccinelle.

    Some amount of new code is currently sitting in linux-next that should get
    the same modifications, which I will do at the end of the merge window.

    Many thanks to Julia Lawall for helping me learn to write a semantic
    patch that does all this.

    ===== begin semantic patch =====
    // This adds an llseek= method to all file operations,
    // as a preparation for making no_llseek the default.
    //
    // The rules are
    // - use no_llseek explicitly if we do nonseekable_open
    // - use seq_lseek for sequential files
    // - use default_llseek if we know we access f_pos
    // - use noop_llseek if we know we don't access f_pos,
    // but we still want to allow users to call lseek
    //
    @ open1 exists @
    identifier nested_open;
    @@
    nested_open(...)
    {

    }

    @ open exists@
    identifier open_f;
    identifier i, f;
    identifier open1.nested_open;
    @@
    int open_f(struct inode *i, struct file *f)
    {

    }

    @ read disable optional_qualifier exists @
    identifier read_f;
    identifier f, p, s, off;
    type ssize_t, size_t, loff_t;
    expression E;
    identifier func;
    @@
    ssize_t read_f(struct file *f, char *p, size_t s, loff_t *off)
    {

    }

    @ read_no_fpos disable optional_qualifier exists @
    identifier read_f;
    identifier f, p, s, off;
    type ssize_t, size_t, loff_t;
    @@
    ssize_t read_f(struct file *f, char *p, size_t s, loff_t *off)
    {
    ... when != off
    }

    @ write @
    identifier write_f;
    identifier f, p, s, off;
    type ssize_t, size_t, loff_t;
    expression E;
    identifier func;
    @@
    ssize_t write_f(struct file *f, const char *p, size_t s, loff_t *off)
    {

    }

    @ write_no_fpos @
    identifier write_f;
    identifier f, p, s, off;
    type ssize_t, size_t, loff_t;
    @@
    ssize_t write_f(struct file *f, const char *p, size_t s, loff_t *off)
    {
    ... when != off
    }

    @ fops0 @
    identifier fops;
    @@
    struct file_operations fops = {
    ...
    };

    @ has_llseek depends on fops0 @
    identifier fops0.fops;
    identifier llseek_f;
    @@
    struct file_operations fops = {
    ...
    .llseek = llseek_f,
    ...
    };

    @ has_read depends on fops0 @
    identifier fops0.fops;
    identifier read_f;
    @@
    struct file_operations fops = {
    ...
    .read = read_f,
    ...
    };

    @ has_write depends on fops0 @
    identifier fops0.fops;
    identifier write_f;
    @@
    struct file_operations fops = {
    ...
    .write = write_f,
    ...
    };

    @ has_open depends on fops0 @
    identifier fops0.fops;
    identifier open_f;
    @@
    struct file_operations fops = {
    ...
    .open = open_f,
    ...
    };

    // use no_llseek if we call nonseekable_open
    ////////////////////////////////////////////
    @ nonseekable1 depends on !has_llseek && has_open @
    identifier fops0.fops;
    identifier nso ~= "nonseekable_open";
    @@
    struct file_operations fops = {
    ... .open = nso, ...
    +.llseek = no_llseek, /* nonseekable */
    };

    @ nonseekable2 depends on !has_llseek @
    identifier fops0.fops;
    identifier open.open_f;
    @@
    struct file_operations fops = {
    ... .open = open_f, ...
    +.llseek = no_llseek, /* open uses nonseekable */
    };

    // use seq_lseek for sequential files
    /////////////////////////////////////
    @ seq depends on !has_llseek @
    identifier fops0.fops;
    identifier sr ~= "seq_read";
    @@
    struct file_operations fops = {
    ... .read = sr, ...
    +.llseek = seq_lseek, /* we have seq_read */
    };

    // use default_llseek if there is a readdir
    ///////////////////////////////////////////
    @ fops1 depends on !has_llseek && !nonseekable1 && !nonseekable2 && !seq @
    identifier fops0.fops;
    identifier readdir_e;
    @@
    // any other fop is used that changes pos
    struct file_operations fops = {
    ... .readdir = readdir_e, ...
    +.llseek = default_llseek, /* readdir is present */
    };

    // use default_llseek if at least one of read/write touches f_pos
    /////////////////////////////////////////////////////////////////
    @ fops2 depends on !fops1 && !has_llseek && !nonseekable1 && !nonseekable2 && !seq @
    identifier fops0.fops;
    identifier read.read_f;
    @@
    // read fops use offset
    struct file_operations fops = {
    ... .read = read_f, ...
    +.llseek = default_llseek, /* read accesses f_pos */
    };

    @ fops3 depends on !fops1 && !fops2 && !has_llseek && !nonseekable1 && !nonseekable2 && !seq @
    identifier fops0.fops;
    identifier write.write_f;
    @@
    // write fops use offset
    struct file_operations fops = {
    ... .write = write_f, ...
    + .llseek = default_llseek, /* write accesses f_pos */
    };

    // Use noop_llseek if neither read nor write accesses f_pos
    ///////////////////////////////////////////////////////////

    @ fops4 depends on !fops1 && !fops2 && !fops3 && !has_llseek && !nonseekable1 && !nonseekable2 && !seq @
    identifier fops0.fops;
    identifier read_no_fpos.read_f;
    identifier write_no_fpos.write_f;
    @@
    // write fops use offset
    struct file_operations fops = {
    ...
    .write = write_f,
    .read = read_f,
    ...
    +.llseek = noop_llseek, /* read and write both use no f_pos */
    };

    @ depends on has_write && !has_read && !fops1 && !fops2 && !has_llseek && !nonseekable1 && !nonseekable2 && !seq @
    identifier fops0.fops;
    identifier write_no_fpos.write_f;
    @@
    struct file_operations fops = {
    ... .write = write_f, ...
    +.llseek = noop_llseek, /* write uses no f_pos */
    };

    @ depends on has_read && !has_write && !fops1 && !fops2 && !has_llseek && !nonseekable1 && !nonseekable2 && !seq @
    identifier fops0.fops;
    identifier read_no_fpos.read_f;
    @@
    struct file_operations fops = {
    ... .read = read_f, ...
    +.llseek = noop_llseek, /* read uses no f_pos */
    };

    @ depends on !has_read && !has_write && !fops1 && !fops2 && !has_llseek && !nonseekable1 && !nonseekable2 && !seq @
    identifier fops0.fops;
    @@
    struct file_operations fops = {
    ...
    +.llseek = noop_llseek, /* no read or write fn */
    };
    ===== End semantic patch =====

    Signed-off-by: Arnd Bergmann
    Cc: Julia Lawall
    Cc: Christoph Hellwig

    Arnd Bergmann
     

12 Oct, 2010

6 commits

  • This omits the redundant "DCCP:" in warning messages, since DCCP_WARN() already
    echoes the function name, avoiding messages like

    kernel: [10988.766503] dccp_close: DCCP: ABORT -- 209 bytes unread

    Signed-off-by: Gerrit Renker

    Gerrit Renker
     
  • This schedules an Ack when receiving a timestamp, exploiting the
    existing inet_csk_schedule_ack() function, saving one case in the
    `dccp_ack_pending()' function.

    Signed-off-by: Gerrit Renker

    Gerrit Renker
     
  • This patch generalises the task of determining data loss from RFC 4340, 7.7.1.

    Let S_A, S_B be sequence numbers such that S_B is "after" S_A, and let
    N_B be the NDP count of packet S_B. Then, using modulo-2^48 arithmetic,
    D = S_B - S_A - 1 is an upper bound of the number of lost data packets,
    D - N_B is an approximation of the number of lost data packets
    (there are cases where this is not exact).

    The patch implements this as
    dccp_loss_count(S_A, S_B, N_B) := max(S_B - S_A - 1 - N_B, 0)

    Signed-off-by: Ivo Calado
    Signed-off-by: Erivaldo Xavier
    Signed-off-by: Leandro Sales
    Signed-off-by: Gerrit Renker

    Ivo Calado
     
  • This removes the argument `more' from ccid_hc_tx_packet_sent, since it was
    nowhere used in the entire code.

    (Btw, this argument was not even used in the original KAME code where the
    function initially came from; compare the variable moreToSend in the
    freebsd61-dccp-kame-28.08.2006.patch kept by Emmanuel Lochin.)

    Signed-off-by: Gerrit Renker

    Gerrit Renker
     
  • After moving the assignment of GAR/ISS from dccp_connect_init() to
    dccp_transmit_skb(), the former function becomes very small, so that
    a merger with dccp_connect() suggests itself.

    Signed-off-by: Gerrit Renker

    Gerrit Renker
     
  • This fixes a problem and a potential loophole with regard to seqno/ackno
    validity: currently the initial adjustments to AWL/SWL are only performed
    once at the begin of the connection, during the handshake.

    Since the Sequence Window feature is always greater than Wmin=32 (7.5.2),
    it is however necessary to perform these adjustments at least for the first
    W/W' (variables as per 7.5.1) packets in the lifetime of a connection.

    This requirement is complicated by the fact that W/W' can change at any time
    during the lifetime of a connection.

    Therefore it is better to perform that safety check each time SWL/AWL are
    updated, as implemented by the patch.

    A second problem solved by this patch is that the remote/local Sequence Window
    feature values (which set the bounds for AWL/SWL/SWH) are undefined until the
    feature negotiation has completed.

    During the initial handshake we have more stringent sequence number protection;
    the changes added by this patch effect that {A,S}W{L,H} are within the correct
    bounds at the instant that feature negotiation completes (since the SeqWin
    feature activation handlers call dccp_update_gsr/gss()).

    Signed-off-by: Gerrit Renker

    Gerrit Renker
     

07 Oct, 2010

1 commit


24 Sep, 2010

1 commit


21 Sep, 2010

1 commit