Skip to content

Commit

Permalink
Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/…
Browse files Browse the repository at this point in the history
…davem/net-2.6

* 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6:
  [CRYPTO] users: Fix up scatterlist conversion errors
  [CRYPTO] tcrypt: Move sg_init_table out of timing loops
  [NETNS]: Fix get_net_ns_by_pid
  [NET]: Marking struct pernet_operations __net_initdata was inappropriate
  [INET] ESP: Must #include <linux/scatterlist.h>
  [TCP] IPV6: fix softnet build breakage
  • Loading branch information
Linus Torvalds committed Oct 27, 2007
2 parents 26adc0d + 68e3f5d commit 0f5a2c5
Show file tree
Hide file tree
Showing 22 changed files with 118 additions and 76 deletions.
20 changes: 14 additions & 6 deletions crypto/tcrypt.c
Original file line number Diff line number Diff line change
Expand Up @@ -572,9 +572,11 @@ static int test_hash_jiffies_digest(struct hash_desc *desc, char *p, int blen,
int bcount;
int ret;

sg_init_table(sg, 1);

for (start = jiffies, end = start + sec * HZ, bcount = 0;
time_before(jiffies, end); bcount++) {
sg_init_one(sg, p, blen);
sg_set_buf(sg, p, blen);
ret = crypto_hash_digest(desc, sg, blen, out);
if (ret)
return ret;
Expand All @@ -597,13 +599,15 @@ static int test_hash_jiffies(struct hash_desc *desc, char *p, int blen,
if (plen == blen)
return test_hash_jiffies_digest(desc, p, blen, out, sec);

sg_init_table(sg, 1);

for (start = jiffies, end = start + sec * HZ, bcount = 0;
time_before(jiffies, end); bcount++) {
ret = crypto_hash_init(desc);
if (ret)
return ret;
for (pcount = 0; pcount < blen; pcount += plen) {
sg_init_one(sg, p + pcount, plen);
sg_set_buf(sg, p + pcount, plen);
ret = crypto_hash_update(desc, sg, plen);
if (ret)
return ret;
Expand All @@ -628,12 +632,14 @@ static int test_hash_cycles_digest(struct hash_desc *desc, char *p, int blen,
int i;
int ret;

sg_init_table(sg, 1);

local_bh_disable();
local_irq_disable();

/* Warm-up run. */
for (i = 0; i < 4; i++) {
sg_init_one(sg, p, blen);
sg_set_buf(sg, p, blen);
ret = crypto_hash_digest(desc, sg, blen, out);
if (ret)
goto out;
Expand All @@ -645,7 +651,7 @@ static int test_hash_cycles_digest(struct hash_desc *desc, char *p, int blen,

start = get_cycles();

sg_init_one(sg, p, blen);
sg_set_buf(sg, p, blen);
ret = crypto_hash_digest(desc, sg, blen, out);
if (ret)
goto out;
Expand Down Expand Up @@ -679,6 +685,8 @@ static int test_hash_cycles(struct hash_desc *desc, char *p, int blen,
if (plen == blen)
return test_hash_cycles_digest(desc, p, blen, out);

sg_init_table(sg, 1);

local_bh_disable();
local_irq_disable();

Expand All @@ -688,7 +696,7 @@ static int test_hash_cycles(struct hash_desc *desc, char *p, int blen,
if (ret)
goto out;
for (pcount = 0; pcount < blen; pcount += plen) {
sg_init_one(sg, p + pcount, plen);
sg_set_buf(sg, p + pcount, plen);
ret = crypto_hash_update(desc, sg, plen);
if (ret)
goto out;
Expand All @@ -708,7 +716,7 @@ static int test_hash_cycles(struct hash_desc *desc, char *p, int blen,
if (ret)
goto out;
for (pcount = 0; pcount < blen; pcount += plen) {
sg_init_one(sg, p + pcount, plen);
sg_set_buf(sg, p + pcount, plen);
ret = crypto_hash_update(desc, sg, plen);
if (ret)
goto out;
Expand Down
4 changes: 2 additions & 2 deletions drivers/crypto/padlock-sha.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ static void padlock_sha_bypass(struct crypto_tfm *tfm)
if (ctx(tfm)->data && ctx(tfm)->used) {
struct scatterlist sg;

sg_set_buf(&sg, ctx(tfm)->data, ctx(tfm)->used);
sg_init_one(&sg, ctx(tfm)->data, ctx(tfm)->used);
crypto_hash_update(&ctx(tfm)->fallback, &sg, sg.length);
}

Expand All @@ -79,7 +79,7 @@ static void padlock_sha_update(struct crypto_tfm *tfm,

if (unlikely(ctx(tfm)->bypass)) {
struct scatterlist sg;
sg_set_buf(&sg, (uint8_t *)data, length);
sg_init_one(&sg, (uint8_t *)data, length);
crypto_hash_update(&ctx(tfm)->fallback, &sg, length);
return;
}
Expand Down
2 changes: 1 addition & 1 deletion drivers/md/dm-crypt.c
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ static int crypt_iv_essiv_ctr(struct crypt_config *cc, struct dm_target *ti,
return -ENOMEM;
}

sg_set_buf(&sg, cc->key, cc->key_size);
sg_init_one(&sg, cc->key, cc->key_size);
desc.tfm = hash_tfm;
desc.flags = CRYPTO_TFM_REQ_MAY_SLEEP;
err = crypto_hash_digest(&desc, &sg, cc->key_size, salt);
Expand Down
2 changes: 1 addition & 1 deletion drivers/net/loopback.c
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ static __net_exit void loopback_net_exit(struct net *net)
unregister_netdev(dev);
}

static struct pernet_operations __net_initdata loopback_net_ops = {
static struct pernet_operations loopback_net_ops = {
.init = loopback_net_init,
.exit = loopback_net_exit,
};
Expand Down
10 changes: 9 additions & 1 deletion drivers/net/ppp_mppe.c
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ MODULE_VERSION("1.0.2");
static unsigned int
setup_sg(struct scatterlist *sg, const void *address, unsigned int length)
{
sg_init_one(sg, address, length);
sg_set_buf(sg, address, length);
return length;
}

Expand Down Expand Up @@ -140,6 +140,8 @@ static void get_new_key_from_sha(struct ppp_mppe_state * state)
struct scatterlist sg[4];
unsigned int nbytes;

sg_init_table(sg, 4);

nbytes = setup_sg(&sg[0], state->master_key, state->keylen);
nbytes += setup_sg(&sg[1], sha_pad->sha_pad1,
sizeof(sha_pad->sha_pad1));
Expand All @@ -166,6 +168,8 @@ static void mppe_rekey(struct ppp_mppe_state * state, int initial_key)
if (!initial_key) {
crypto_blkcipher_setkey(state->arc4, state->sha1_digest,
state->keylen);
sg_init_table(sg_in, 1);
sg_init_table(sg_out, 1);
setup_sg(sg_in, state->sha1_digest, state->keylen);
setup_sg(sg_out, state->session_key, state->keylen);
if (crypto_blkcipher_encrypt(&desc, sg_out, sg_in,
Expand Down Expand Up @@ -421,6 +425,8 @@ mppe_compress(void *arg, unsigned char *ibuf, unsigned char *obuf,
isize -= 2;

/* Encrypt packet */
sg_init_table(sg_in, 1);
sg_init_table(sg_out, 1);
setup_sg(sg_in, ibuf, isize);
setup_sg(sg_out, obuf, osize);
if (crypto_blkcipher_encrypt(&desc, sg_out, sg_in, isize) != 0) {
Expand Down Expand Up @@ -608,6 +614,8 @@ mppe_decompress(void *arg, unsigned char *ibuf, int isize, unsigned char *obuf,
* Decrypt the first byte in order to check if it is
* a compressed or uncompressed protocol field.
*/
sg_init_table(sg_in, 1);
sg_init_table(sg_out, 1);
setup_sg(sg_in, ibuf, 1);
setup_sg(sg_out, obuf, 1);
if (crypto_blkcipher_decrypt(&desc, sg_out, sg_in, 1) != 0) {
Expand Down
5 changes: 2 additions & 3 deletions drivers/scsi/iscsi_tcp.c
Original file line number Diff line number Diff line change
Expand Up @@ -674,9 +674,8 @@ partial_sg_digest_update(struct hash_desc *desc, struct scatterlist *sg,
{
struct scatterlist temp;

memcpy(&temp, sg, sizeof(struct scatterlist));
temp.offset = offset;
temp.length = length;
sg_init_table(&temp, 1);
sg_set_page(&temp, sg_page(sg), length, offset);
crypto_hash_update(desc, &temp, length);
}

Expand Down
2 changes: 2 additions & 0 deletions fs/ecryptfs/crypto.c
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,8 @@ int virt_to_scatterlist(const void *addr, int size, struct scatterlist *sg,
int offset;
int remainder_of_page;

sg_init_table(sg, sg_size);

while (size > 0 && i < sg_size) {
pg = virt_to_page(addr);
offset = offset_in_page(addr);
Expand Down
2 changes: 1 addition & 1 deletion fs/proc/proc_net.c
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ static __net_exit void proc_net_ns_exit(struct net *net)
kfree(net->proc_net_root);
}

static struct pernet_operations __net_initdata proc_net_ns_ops = {
static struct pernet_operations proc_net_ns_ops = {
.init = proc_net_ns_init,
.exit = proc_net_ns_exit,
};
Expand Down
2 changes: 0 additions & 2 deletions include/net/net_namespace.h
Original file line number Diff line number Diff line change
Expand Up @@ -102,11 +102,9 @@ static inline void release_net(struct net *net)
#ifdef CONFIG_NET_NS
#define __net_init
#define __net_exit
#define __net_initdata
#else
#define __net_init __init
#define __net_exit __exit_refok
#define __net_initdata __initdata
#endif

struct pernet_operations {
Expand Down
6 changes: 3 additions & 3 deletions net/core/dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -2668,7 +2668,7 @@ static void __net_exit dev_proc_net_exit(struct net *net)
proc_net_remove(net, "dev");
}

static struct pernet_operations __net_initdata dev_proc_ops = {
static struct pernet_operations dev_proc_ops = {
.init = dev_proc_net_init,
.exit = dev_proc_net_exit,
};
Expand Down Expand Up @@ -4328,7 +4328,7 @@ static void __net_exit netdev_exit(struct net *net)
kfree(net->dev_index_head);
}

static struct pernet_operations __net_initdata netdev_net_ops = {
static struct pernet_operations netdev_net_ops = {
.init = netdev_init,
.exit = netdev_exit,
};
Expand Down Expand Up @@ -4359,7 +4359,7 @@ static void __net_exit default_device_exit(struct net *net)
rtnl_unlock();
}

static struct pernet_operations __net_initdata default_device_ops = {
static struct pernet_operations default_device_ops = {
.exit = default_device_exit,
};

Expand Down
2 changes: 1 addition & 1 deletion net/core/dev_mcast.c
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ static void __net_exit dev_mc_net_exit(struct net *net)
proc_net_remove(net, "dev_mcast");
}

static struct pernet_operations __net_initdata dev_mc_net_ops = {
static struct pernet_operations dev_mc_net_ops = {
.init = dev_mc_net_init,
.exit = dev_mc_net_exit,
};
Expand Down
2 changes: 1 addition & 1 deletion net/core/rtnetlink.c
Original file line number Diff line number Diff line change
Expand Up @@ -742,7 +742,7 @@ static struct net *get_net_ns_by_pid(pid_t pid)
/* Lookup the network namespace */
net = ERR_PTR(-ESRCH);
rcu_read_lock();
tsk = find_task_by_pid(pid);
tsk = find_task_by_vpid(pid);
if (tsk) {
struct nsproxy *nsproxy;
nsproxy = task_nsproxy(tsk);
Expand Down
9 changes: 6 additions & 3 deletions net/ipv4/esp4.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#include <net/ip.h>
#include <net/xfrm.h>
#include <net/esp.h>
#include <asm/scatterlist.h>
#include <linux/scatterlist.h>
#include <linux/crypto.h>
#include <linux/kernel.h>
#include <linux/pfkeyv2.h>
Expand Down Expand Up @@ -111,7 +111,9 @@ static int esp_output(struct xfrm_state *x, struct sk_buff *skb)
goto unlock;
}
sg_init_table(sg, nfrags);
skb_to_sgvec(skb, sg, esph->enc_data+esp->conf.ivlen-skb->data, clen);
sg_mark_end(sg, skb_to_sgvec(skb, sg, esph->enc_data +
esp->conf.ivlen -
skb->data, clen));
err = crypto_blkcipher_encrypt(&desc, sg, sg, clen);
if (unlikely(sg != &esp->sgbuf[0]))
kfree(sg);
Expand Down Expand Up @@ -203,7 +205,8 @@ static int esp_input(struct xfrm_state *x, struct sk_buff *skb)
goto out;
}
sg_init_table(sg, nfrags);
skb_to_sgvec(skb, sg, sizeof(*esph) + esp->conf.ivlen, elen);
sg_mark_end(sg, skb_to_sgvec(skb, sg, sizeof(*esph) + esp->conf.ivlen,
elen));
err = crypto_blkcipher_decrypt(&desc, sg, sg, elen);
if (unlikely(sg != &esp->sgbuf[0]))
kfree(sg);
Expand Down
10 changes: 7 additions & 3 deletions net/ipv6/esp6.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
#include <net/ip.h>
#include <net/xfrm.h>
#include <net/esp.h>
#include <asm/scatterlist.h>
#include <linux/scatterlist.h>
#include <linux/crypto.h>
#include <linux/kernel.h>
#include <linux/pfkeyv2.h>
Expand Down Expand Up @@ -110,7 +110,9 @@ static int esp6_output(struct xfrm_state *x, struct sk_buff *skb)
goto unlock;
}
sg_init_table(sg, nfrags);
skb_to_sgvec(skb, sg, esph->enc_data+esp->conf.ivlen-skb->data, clen);
sg_mark_end(sg, skb_to_sgvec(skb, sg, esph->enc_data +
esp->conf.ivlen -
skb->data, clen));
err = crypto_blkcipher_encrypt(&desc, sg, sg, clen);
if (unlikely(sg != &esp->sgbuf[0]))
kfree(sg);
Expand Down Expand Up @@ -207,7 +209,9 @@ static int esp6_input(struct xfrm_state *x, struct sk_buff *skb)
}
}
sg_init_table(sg, nfrags);
skb_to_sgvec(skb, sg, sizeof(*esph) + esp->conf.ivlen, elen);
sg_mark_end(sg, skb_to_sgvec(skb, sg,
sizeof(*esph) + esp->conf.ivlen,
elen));
ret = crypto_blkcipher_decrypt(&desc, sg, sg, elen);
if (unlikely(sg != &esp->sgbuf[0]))
kfree(sg);
Expand Down
1 change: 1 addition & 0 deletions net/ipv6/tcp_ipv6.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
#include <net/snmp.h>
#include <net/dsfield.h>
#include <net/timewait_sock.h>
#include <net/netdma.h>

#include <asm/uaccess.h>

Expand Down
2 changes: 1 addition & 1 deletion net/netlink/af_netlink.c
Original file line number Diff line number Diff line change
Expand Up @@ -1888,7 +1888,7 @@ static void __net_exit netlink_net_exit(struct net *net)
#endif
}

static struct pernet_operations __net_initdata netlink_net_ops = {
static struct pernet_operations netlink_net_ops = {
.init = netlink_net_init,
.exit = netlink_net_exit,
};
Expand Down
Loading

0 comments on commit 0f5a2c5

Please sign in to comment.