Skip to content

Commit 4a009cb

Browse files
edumazetdavem330
authored andcommitted
net: add __must_check to skb_put_padto()
skb_put_padto() and __skb_put_padto() callers must check return values or risk use-after-free. Signed-off-by: Eric Dumazet <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 3ca1a42 commit 4a009cb

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

include/linux/skbuff.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3223,8 +3223,9 @@ static inline int skb_padto(struct sk_buff *skb, unsigned int len)
32233223
* is untouched. Otherwise it is extended. Returns zero on
32243224
* success. The skb is freed on error if @free_on_error is true.
32253225
*/
3226-
static inline int __skb_put_padto(struct sk_buff *skb, unsigned int len,
3227-
bool free_on_error)
3226+
static inline int __must_check __skb_put_padto(struct sk_buff *skb,
3227+
unsigned int len,
3228+
bool free_on_error)
32283229
{
32293230
unsigned int size = skb->len;
32303231

@@ -3247,7 +3248,7 @@ static inline int __skb_put_padto(struct sk_buff *skb, unsigned int len,
32473248
* is untouched. Otherwise it is extended. Returns zero on
32483249
* success. The skb is freed on error.
32493250
*/
3250-
static inline int skb_put_padto(struct sk_buff *skb, unsigned int len)
3251+
static inline int __must_check skb_put_padto(struct sk_buff *skb, unsigned int len)
32513252
{
32523253
return __skb_put_padto(skb, len, true);
32533254
}

0 commit comments

Comments
 (0)