mirror of
https://github.com/ceph/ceph
synced 2025-02-20 17:37:29 +00:00
crush: CrushWrapper::add_bucket - do not allow caller pass in null 'idout'
*** Caught signal (Segmentation fault) ** in thread 7f495c0f6300 thread_name:crushtool ceph version 12.1.2-768-gab69125 (ab6912523e779174f92f0b0fc10372bd0b645415) mimic (dev) 1: (()+0x1a3d1) [0x7f495c1343d1] 2: (()+0xf370) [0x7f4951deb370] 3: (CrushWrapper::add_bucket(int, int, int, int, int, int*, int*, int*)+0x84) [0x7f49538ba084] 4: (CrushCompiler::parse_bucket(__gnu_cxx::__normal_iterator<boost::spirit::tree_node<boost::spirit::node_val_data<char const*, boost::spirit::nil_t> >*, std::vector<boost::spirit::tree_node<boost::spirit::node_val_data<char const*, boost::spirit::nil_t> >, std::allocator<boost::spirit::tree_node<boost::spirit::node_val_data<char const*, boost::spirit::nil_t> > > > > const&)+0xef0) [0x7f49538dc170] 5: (CrushCompiler::parse_crush(__gnu_cxx::__normal_iterator<boost::spirit::tree_node<boost::spirit::node_val_data<char const*, boost::spirit::nil_t> >*, std::vector<boost::spirit::tree_node<boost::spirit::node_val_data<char const*, boost::spirit::nil_t> >, std::allocator<boost::spirit::tree_node<boost::spirit::node_val_data<char const*, boost::spirit::nil_t> > > > > const&)+0x130) [0x7f49538dcba0] 6: (CrushCompiler::compile(std::istream&, char const*)+0xb93) [0x7f49538deaa3] 7: (main()+0x2615) [0x7f495c126015] 8: (__libc_start_main()+0xf5) [0x7f49507ccb35] 9: (()+0xf4b0) [0x7f495c1294b0] 2017-08-14 13:31:25.498050 7f495c0f6300 -1 *** Caught signal (Segmentation fault) ** in thread 7f495c0f6300 thread_name:crushtool Signed-off-by: xie xingguo <xie.xingguo@zte.com.cn>
This commit is contained in:
parent
0c8ca02727
commit
dc8f925cb4
@ -741,7 +741,9 @@ int CrushCompiler::parse_bucket(iter_t const& i)
|
||||
item_weight[id] = bucketweight;
|
||||
|
||||
assert(id != 0);
|
||||
int r = crush.add_bucket(id, alg, hash, type, size, &items[0], &weights[0], NULL);
|
||||
int idout;
|
||||
int r = crush.add_bucket(id, alg, hash, type, size,
|
||||
&items[0], &weights[0], &idout);
|
||||
if (r < 0) {
|
||||
if (r == -EEXIST)
|
||||
err << "Duplicate bucket id " << id << std::endl;
|
||||
|
@ -1702,6 +1702,7 @@ int CrushWrapper::add_bucket(
|
||||
crush_bucket *b = crush_make_bucket(crush, alg, hash, type, size, items,
|
||||
weights);
|
||||
assert(b);
|
||||
assert(idout);
|
||||
int r = crush_add_bucket(crush, bucketno, b, idout);
|
||||
int pos = -1 - *idout;
|
||||
for (auto& p : choose_args) {
|
||||
|
Loading…
Reference in New Issue
Block a user