summaryrefslogtreecommitdiffstats
path: root/net/packet
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2015-08-07 13:53:41 +0200
committerTakashi Iwai <tiwai@suse.de>2015-08-07 13:53:41 +0200
commit6ac7ada210a8d23a56fbf18b6e1e00528844565c (patch)
treef62352a9b08e560f41cd4008ec0029b6b026d3a5 /net/packet
parent73851b36fe73819f8c201971e913324d4846a7ea (diff)
parentd00a9e02178401433fc386e69c936f2039f07b57 (diff)
downloadblackbird-obmc-linux-6ac7ada210a8d23a56fbf18b6e1e00528844565c.tar.gz
blackbird-obmc-linux-6ac7ada210a8d23a56fbf18b6e1e00528844565c.zip
Merge tag 'asoc-fix-v4.2-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into for-linus
ASoC: Fixes for v4.2 There are a couple of small driver specific fixes here but the overwhelming bulk of these changes are fixes to the topology ABI that has been newly introduced in v4.2. Once this makes it into a release we will have to firm this up but for now getting enhancements in before they've made it into a release is the most expedient thing.
Diffstat (limited to 'net/packet')
-rw-r--r--net/packet/af_packet.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c
index c9e8741226c6..ed458b315ef4 100644
--- a/net/packet/af_packet.c
+++ b/net/packet/af_packet.c
@@ -2403,7 +2403,8 @@ static int tpacket_snd(struct packet_sock *po, struct msghdr *msg)
}
tp_len = tpacket_fill_skb(po, skb, ph, dev, size_max, proto,
addr, hlen);
- if (tp_len > dev->mtu + dev->hard_header_len) {
+ if (likely(tp_len >= 0) &&
+ tp_len > dev->mtu + dev->hard_header_len) {
struct ethhdr *ehdr;
/* Earlier code assumed this would be a VLAN pkt,
* double-check this now that we have the actual
@@ -2784,7 +2785,7 @@ static int packet_release(struct socket *sock)
static int packet_do_bind(struct sock *sk, struct net_device *dev, __be16 proto)
{
struct packet_sock *po = pkt_sk(sk);
- const struct net_device *dev_curr;
+ struct net_device *dev_curr;
__be16 proto_curr;
bool need_rehook;
@@ -2808,15 +2809,13 @@ static int packet_do_bind(struct sock *sk, struct net_device *dev, __be16 proto)
po->num = proto;
po->prot_hook.type = proto;
-
- if (po->prot_hook.dev)
- dev_put(po->prot_hook.dev);
-
po->prot_hook.dev = dev;
po->ifindex = dev ? dev->ifindex : 0;
packet_cached_dev_assign(po, dev);
}
+ if (dev_curr)
+ dev_put(dev_curr);
if (proto == 0 || !need_rehook)
goto out_unlock;
OpenPOWER on IntegriCloud