aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--net/strparser/strparser.c26
1 files changed, 15 insertions, 11 deletions
diff --git a/net/strparser/strparser.c b/net/strparser/strparser.c
index 373836615c57..4f40a90ca016 100644
--- a/net/strparser/strparser.c
+++ b/net/strparser/strparser.c
@@ -155,11 +155,13 @@ static int __strp_recv(read_descriptor_t *desc, struct sk_buff *orig_skb,
155 /* We are going to append to the frags_list of head. 155 /* We are going to append to the frags_list of head.
156 * Need to unshare the frag_list. 156 * Need to unshare the frag_list.
157 */ 157 */
158 err = skb_unclone(head, GFP_ATOMIC); 158 if (skb_has_frag_list(head)) {
159 if (err) { 159 err = skb_unclone(head, GFP_ATOMIC);
160 STRP_STATS_INCR(strp->stats.mem_fail); 160 if (err) {
161 desc->error = err; 161 STRP_STATS_INCR(strp->stats.mem_fail);
162 return 0; 162 desc->error = err;
163 return 0;
164 }
163 } 165 }
164 166
165 if (unlikely(skb_shinfo(head)->frag_list)) { 167 if (unlikely(skb_shinfo(head)->frag_list)) {
@@ -216,14 +218,16 @@ static int __strp_recv(read_descriptor_t *desc, struct sk_buff *orig_skb,
216 memset(stm, 0, sizeof(*stm)); 218 memset(stm, 0, sizeof(*stm));
217 stm->strp.offset = orig_offset + eaten; 219 stm->strp.offset = orig_offset + eaten;
218 } else { 220 } else {
219 /* Unclone since we may be appending to an skb that we 221 /* Unclone if we are appending to an skb that we
220 * already share a frag_list with. 222 * already share a frag_list with.
221 */ 223 */
222 err = skb_unclone(skb, GFP_ATOMIC); 224 if (skb_has_frag_list(skb)) {
223 if (err) { 225 err = skb_unclone(skb, GFP_ATOMIC);
224 STRP_STATS_INCR(strp->stats.mem_fail); 226 if (err) {
225 desc->error = err; 227 STRP_STATS_INCR(strp->stats.mem_fail);
226 break; 228 desc->error = err;
229 break;
230 }
227 } 231 }
228 232
229 stm = _strp_msg(head); 233 stm = _strp_msg(head);