@@ -1499,7 +1499,7 @@ static inline void skb_zcopy_init(struct sk_buff *skb, struct ubuf_info *uarg)
static inline void skb_zcopy_set(struct sk_buff *skb, struct ubuf_info *uarg,
bool *have_ref)
{
- if (skb && uarg && !skb_zcopy(skb)) {
+ if (uarg && !skb_zcopy(skb)) {
if (unlikely(have_ref && *have_ref))
*have_ref = false;
else
@@ -1010,7 +1010,8 @@ static int __ip_append_data(struct sock *sk,
paged = true;
} else {
uarg->zerocopy = 0;
- skb_zcopy_set(skb, uarg, &extra_uref);
+ if (skb)
+ skb_zcopy_set(skb, uarg, &extra_uref);
}
}
@@ -1522,7 +1522,8 @@ static int __ip6_append_data(struct sock *sk,
paged = true;
} else {
uarg->zerocopy = 0;
- skb_zcopy_set(skb, uarg, &extra_uref);
+ if (skb)
+ skb_zcopy_set(skb, uarg, &extra_uref);
}
}
Only two skb_zcopy_set() callers may pass a NULL skb, so kill the zero check from inside the function, which can't be compiled out, and place it where needed. It's also needed by the following patch. Signed-off-by: Pavel Begunkov <asml.silence@gmail.com> --- include/linux/skbuff.h | 2 +- net/ipv4/ip_output.c | 3 ++- net/ipv6/ip6_output.c | 3 ++- 3 files changed, 5 insertions(+), 3 deletions(-)