aboutsummaryrefslogtreecommitdiffstats
path: root/net/bridge
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2012-06-27 00:23:42 -0400
committerDavid S. Miller <davem@davemloft.net>2012-06-27 00:23:42 -0400
commit62566ca55de3a329ef2569d7e7c9d0a326abede2 (patch)
treeefcc07b6a52fb93e9c92ff945a2279cd6d4e2e42 /net/bridge
parenta8edf8a690817ebfe68aa14c4bc482f62699077f (diff)
netfilter: ebt_ulog: Move away from NLMSG_PUT().
And use nlmsg_data() while we're here too. Also, free and NULL out skb when nlmsg_put() fails and remove pointless kernel log message. Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/bridge')
-rw-r--r--net/bridge/netfilter/ebt_ulog.c23
1 files changed, 10 insertions, 13 deletions
diff --git a/net/bridge/netfilter/ebt_ulog.c b/net/bridge/netfilter/ebt_ulog.c
index 5449294bdd5e..1bd173218f7b 100644
--- a/net/bridge/netfilter/ebt_ulog.c
+++ b/net/bridge/netfilter/ebt_ulog.c
@@ -145,19 +145,24 @@ static void ebt_ulog_packet(unsigned int hooknr, const struct sk_buff *skb,
145 145
146 if (!ub->skb) { 146 if (!ub->skb) {
147 if (!(ub->skb = ulog_alloc_skb(size))) 147 if (!(ub->skb = ulog_alloc_skb(size)))
148 goto alloc_failure; 148 goto unlock;
149 } else if (size > skb_tailroom(ub->skb)) { 149 } else if (size > skb_tailroom(ub->skb)) {
150 ulog_send(group); 150 ulog_send(group);
151 151
152 if (!(ub->skb = ulog_alloc_skb(size))) 152 if (!(ub->skb = ulog_alloc_skb(size)))
153 goto alloc_failure; 153 goto unlock;
154 } 154 }
155 155
156 nlh = NLMSG_PUT(ub->skb, 0, ub->qlen, 0, 156 nlh = nlmsg_put(ub->skb, 0, ub->qlen, 0,
157 size - NLMSG_ALIGN(sizeof(*nlh))); 157 size - NLMSG_ALIGN(sizeof(*nlh)), 0);
158 if (!nlh) {
159 kfree(ub->skb);
160 ub->skb = NULL;
161 goto unlock;
162 }
158 ub->qlen++; 163 ub->qlen++;
159 164
160 pm = NLMSG_DATA(nlh); 165 pm = nlmsg_data(nlh);
161 166
162 /* Fill in the ulog data */ 167 /* Fill in the ulog data */
163 pm->version = EBT_ULOG_VERSION; 168 pm->version = EBT_ULOG_VERSION;
@@ -209,14 +214,6 @@ static void ebt_ulog_packet(unsigned int hooknr, const struct sk_buff *skb,
209 214
210unlock: 215unlock:
211 spin_unlock_bh(lock); 216 spin_unlock_bh(lock);
212
213 return;
214
215nlmsg_failure:
216 pr_debug("error during NLMSG_PUT. This should "
217 "not happen, please report to author.\n");
218alloc_failure:
219 goto unlock;
220} 217}
221 218
222/* this function is registered with the netfilter core */ 219/* this function is registered with the netfilter core */